49 lines
1.6 KiB
Lua
49 lines
1.6 KiB
Lua
local Action_RoundStart = {
|
||
}
|
||
|
||
-- 触发器激活时,将执行Action的Execute
|
||
function Action_RoundStart:Execute(...)
|
||
-- 倒计时时间
|
||
UGCLogSystem.Log("[Action_RoundStart:Execute] 执行")
|
||
self.LastRoundTime = DefaultSettings.RoundInfo.EachRoundTime;
|
||
--
|
||
self.CounterTime = 0.;
|
||
self.TotalRoundTime = self.LastRoundTime;
|
||
|
||
-- 销毁所有载具
|
||
UGCGameSystem.GameState:DestroyVehicles();
|
||
|
||
--- 激活 Pawn
|
||
--UE.RespawnAllPlayer(0.5);
|
||
|
||
UGCEventSystem.SetTimer(self, function()
|
||
UGCGameSystem.SendModeCustomEvent("ResetAllPlayer")
|
||
end, 1);
|
||
|
||
UGCGameSystem.GameState:StartRound();
|
||
self.bEnableActionTick = true;
|
||
return true;
|
||
end
|
||
|
||
-- 需要勾选Action的EnableTick,才会执行Update
|
||
-- 触发器激活后,将在每个tick执行Action的Update,直到self.bEnableActionTick为false
|
||
function Action_RoundStart:Update(DeltaSeconds)
|
||
if self.LastRoundTime > 0. then
|
||
self.LastRoundTime = self.LastRoundTime - DeltaSeconds;
|
||
self.CounterTime = self.CounterTime + DeltaSeconds;
|
||
if self.CounterTime >= 1 then
|
||
self.CounterTime = self.CounterTime - 1;
|
||
if self.LastRoundTime > 0 then
|
||
UGCGameSystem.GameState:UpdateRoundTime(self.LastRoundTime);
|
||
end
|
||
end
|
||
|
||
if self.LastRoundTime <= 0 then
|
||
UGCLogSystem.Log("[Action_RoundStart:Update] 进入 Round Settle");
|
||
UGCGameSystem.GameState:UpdateRoundTime();
|
||
self.bEnableActionTick = false;
|
||
end
|
||
end
|
||
end
|
||
|
||
return Action_RoundStart; |