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

59 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 EventAction_RoundEnd = {
GameTime = 0;
GameEndEvent = -1;
NewRoundEvent = -1
}
-- 触发器激活时将执行Action的Execute
function EventAction_RoundEnd:Execute(...)
if not UGCGameSystem.IsServer() then return end
self.bEnableActionTick = true
-- 关闭观战
local AllController = UGCGameSystem.GetAllPlayerController()
for i, PC in pairs(AllController) do
UGCGameSystem.LeaveSpectating(PC)
-- 取消场景摄像机
PC:Server_SetSceneCamera(false)
end
-- 发送回合结束事件到客户端
-- UGCSendRPCSystem.RPCEvent(nil, EventEnum.RoundEnd)
UGCLogSystem.Log("[EventAction_RoundEnd_Execute] Finish")
return true
end
function EventAction_RoundEnd:GameFinish()
-- UGCSendRPCSystem.ClientShowUI(nil, WidgetConfig.EUIType.MiniGameFinish, false)
-- 是否达到最大轮次
if GlobalConfigs.GameSetting.MiniGameNum <= UGCGameSystem.GameState:GetNowMiniGameIndex() then
UGCGameSystem.GameState:GameFinish()
-- 发送游戏结束事件
UGCEventSystem.SendEvent(self.GameEndEvent)
else
UGCGameSystem.GameState:NewMiniGame()
-- 触发新的回合事件
UGCEventSystem.SendEvent(self.NewRoundEvent)
--local AllPawn = UGCGameSystem.GetAllPlayerPawn()
--for i, v in pairs(AllPawn) do
-- v:K2_DestroyActor()
--end
end
end
function EventAction_RoundEnd:Update(DeltaSeconds)
self.GameTime = self.GameTime - DeltaSeconds
if self.GameTime <= 0 then
self.bEnableActionTick = false
self:GameFinish()
end
end
return EventAction_RoundEnd