48 lines
1.4 KiB
Lua
48 lines
1.4 KiB
Lua
---@class BP_TrapKillBox_C:AActor
|
|
---@field Box UBoxComponent
|
|
---@field DefaultSceneRoot USceneComponent
|
|
---@field Damage float
|
|
--Edit Below--
|
|
---@type BP_DamageBox_C
|
|
local BP_MiniGameKillBox = {
|
|
CheckOverlapTime = 0.5;
|
|
LastCheckTime = 0;
|
|
};
|
|
|
|
function BP_MiniGameKillBox:ReceiveBeginPlay()
|
|
self.SuperClass.ReceiveBeginPlay(self);
|
|
if UGCGameSystem.IsServer() then
|
|
UGCSystemLibrary.BindBeginOverlapFunc(self.Box, self.Box_OnComponentBeginOverlap, self)
|
|
|
|
end
|
|
end
|
|
|
|
function BP_MiniGameKillBox:Box_OnComponentBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult)
|
|
if UE.IsValid(OtherActor) then
|
|
local PlayerKey = OtherActor.PlayerKey
|
|
if PlayerKey then
|
|
UGCLogSystem.Log("[BP_MiniGameKillBox_Box_OnComponentBeginOverlap] PlayerKey:%s", tostring(PlayerKey))
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerDropMiniGameKillBox, PlayerKey)
|
|
end
|
|
end
|
|
return nil;
|
|
end
|
|
|
|
|
|
function BP_MiniGameKillBox:ReceiveTick(DeltaTime)
|
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
|
self.LastCheckTime = self.LastCheckTime + DeltaTime
|
|
if self.LastCheckTime >= self.CheckOverlapTime then
|
|
self.LastCheckTime = 0
|
|
local AllPawn = UGCGameSystem.GetAllPlayerPawn()
|
|
for i, v in pairs(AllPawn) do
|
|
if self.Box:IsOverlappingActor(v) and v.PlayerKey then
|
|
UGCEventSystem.SendEvent(EventEnum.PlayerDropMiniGameKillBox, v.PlayerKey)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- [Editor Generated Lua] function define End;
|
|
|
|
return BP_MiniGameKillBox; |