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

39 lines
1.2 KiB
Lua
Raw Permalink 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_GameActive = {}
-- 触发器激活时将执行Action的Execute
function Action_GameActive:Execute(...)
self:LuaInit()
return true
end
function Action_GameActive:LuaInit()
self.TotalWaitTime = DefaultSettings.SelectMapTime + DefaultSettings.SelectSoldierTime;
self.IncreaseTime = 0.;
self.CountDownTimer = 0.;
UGCEventSystem.AddListener(EventTypes.AllPlayerHadSelectMap, self.OnAllPlayerHadSelectMap, self)
end
function Action_GameActive:Update(DeltaSeconds)
if self.TotalWaitTime > 0 then
self.TotalWaitTime = self.TotalWaitTime - DeltaSeconds;
self.CountDownTimer = self.CountDownTimer + DeltaSeconds;
if self.CountDownTimer >= .5 then
self.CountDownTimer = self.CountDownTimer - .5;
if self.TotalWaitTime <= 0.5 then
UGCLogSystem.Log("[Action_GameActive:Update] 进入Update CountDown")
UGCGameSystem.GameState:UpdateCountDown(0);
self.bEnableActionTick = false;
else
UGCLogSystem.Log("[Action_GameActive:Update] self.TotalWaitTime = %s", tostring(self.TotalWaitTime))
UGCGameSystem.GameState:UpdateCountDown(self.TotalWaitTime);
end
end
end
end
function Action_GameActive:OnAllPlayerHadSelectMap(InTime)
self.TotalWaitTime = InTime;
end
return Action_GameActive;