2025-01-04 23:00:19 +08:00

57 lines
1.6 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 EventAction_RoundEnd = {
GameTime = 0;
GameEndEvent = -1;
NewRoundEvent = -1
}
-- 触发器激活时将执行Action的Execute
function EventAction_RoundEnd:Execute(...)
if not UGCGameSystem.IsServer() then return end
self.GameTimeInst = self.GameTime
-- 设置无敌状态
local AllPawn = UGCGameSystem.GetAllPlayerPawn()
for i, v in pairs(AllPawn) do
UGCPawnSystem.SetIsInvincible(v, true)
end
self:ExecuteOtherLogic()
self.bEnableActionTick = true
return true
end
function EventAction_RoundEnd:GameFinish()
self.bEnableActionTick = false
-- 判断游戏是否结束
if self:CheckGameEnd() then
UGCGameSystem.GameState:GameFinish()
-- 发送游戏结束事件
UGCEventSystem.SendEvent(self.GameEndEvent)
else
-- 触发新的回合事件
UGCEventSystem.SendEvent(self.NewRoundEvent)
end
end
function EventAction_RoundEnd:Update(DeltaSeconds)
self.GameTimeInst = self.GameTimeInst - DeltaSeconds
if self.GameTimeInst <= 0 then
self:GameFinish()
end
end
function EventAction_RoundEnd:ExecuteOtherLogic()
local IsAttackSucceed = UGCGameSystem.GameState:IsBreakThroughSucceed()
-- 显示回合结束界面UI
UGCGameSystem.GameState:ShowSimplePlayModeUI(WidgetConfig.EUIType.RoundFinish, { IsAttackSucceed,})
end
--- 判断玩法是否结束 根据玩法进行修改
function EventAction_RoundEnd:CheckGameEnd()
return UGCGameSystem.GameState:IsFinishRound() or #UGCTeamSystem.GetPlayerKeysByTeamID(1) < 1 or #UGCTeamSystem.GetPlayerKeysByTeamID(2) < 1
end
return EventAction_RoundEnd