39 lines
1.2 KiB
Lua
39 lines
1.2 KiB
Lua
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; |