59 lines
1.6 KiB
Lua
59 lines
1.6 KiB
Lua
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 |