UGCProjects/ProjectTemp_T/Script/gamemode/Action_RoundStart.lua
2025-01-04 23:00:19 +08:00

49 lines
1.6 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;