77 lines
1.8 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class BP_BoltItem_C:AActor
---@field ParticleSystem UParticleSystemComponent
---@field Capsule UCapsuleComponent
---@field DefaultSceneRoot USceneComponent
--Edit Below--
---@type BP_BoltItem_C
local BP_BoltItem = {}
BP_BoltItem.ItemId = 0;
function BP_BoltItem:ReceiveBeginPlay()
BP_BoltItem.SuperClass.ReceiveBeginPlay(self)
self.Capsule.OnComponentBeginOverlap:Add(self.OnBeginOverlap, self);
if IsServer then
UGCEventSystem.SetTimer(self, function()
self:DelaySetItemId();
end, 2);
end
end
---@param OtherActor UGCPlayerPawn_C
function BP_BoltItem:OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
if IsServer then
if UE.IsPlayerPawn(OtherActor) and self.ItemId ~= 0 then
GlobalMiniMode:PlayerAddBolt(OtherActor, self.ItemId, nil);
-- 延迟生成
UGCEventSystem.SetTimer(self, function()
self:DelaySetItemId();
end, 2);
self.ItemId = 0;
DOREPONCE(self, "ItemId");
end
end
end
function BP_BoltItem:OnRep_ItemId()
if self.ItemId ~= 0 then
-- 显示出来
self.ParticleSystem:SetHiddenInGame(false, true);
else
self.ParticleSystem:SetHiddenInGame(true, true);
end
end
function BP_BoltItem:DelaySetItemId()
self.ItemId = EBoltBuffType[GlobalMiniMode.CanSelectBuffs[math.random(#GlobalMiniMode.CanSelectBuffs)]];
UGCLogSystem.Log("[BP_BoltItem:DelaySetItemId] self.ItemId = %s", tostring(self.ItemId));
DOREPONCE(self, "ItemId");
end
function BP_BoltItem:ShowEmitter()
end
--[[
function BP_BoltItem:ReceiveTick(DeltaTime)
BP_BoltItem.SuperClass.ReceiveTick(self, DeltaTime)
end
--]]
--[[
function BP_BoltItem:ReceiveEndPlay()
BP_BoltItem.SuperClass.ReceiveEndPlay(self)
end
--]]
function BP_BoltItem:GetReplicatedProperties()
return { "ItemId", "Lazy" }
end
--[[
function BP_BoltItem:GetAvailableServerRPCs()
return
end
--]]
return BP_BoltItem