local EventSystem = require('Event/EventSystem') local ExpUISystem = require "Battle/Expression/ExpEntity/System/ExpUISystem" local EntityHeadUIModule = require("View/Battle/BattleEntityUI/EntityUIModule/EntityHeadUIModule") local Base = require("Battle/Expression/ExpLevel/ExpLevelFunction/ExpLevelFunction") local ExpAttackCityLevelFunction = class("ExpAttackCityLevelFunction",Base) function ExpAttackCityLevelFunction:OnInitLevel() Base.OnInitLevel(self) self.timescale = FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GVGFightSpeedUpRation").FloatValue) UnityEngine.Time.timeScale = self.timescale end function ExpAttackCityLevelFunction:AfterEnemyHeroesCreated(heroEntityTable) for i,entity in ipairs(heroEntityTable) do if entity:GetPlayerID() == LuaConst.STANDALONE_ENEMYPLAYER1_PLAYID then if i > 1 then --策划要求对面值只显示1个血条,所以除了第1个,全都删了。对面有血条的英雄死后会自动显示下面顺位的英雄的血条 EventSystem.Dispatch(EventID.UIBattle_Element_RemoveHeadUI, entity.ExpEntity.RenderEntity, EntityHeadUIModule.HeadUIType.Guild) end end end end function ExpAttackCityLevelFunction:OnLevelSucceed(withShow) UnityEngine.Time.timeScale = 1 Base.OnLevelSucceed(self, withShow) end function ExpAttackCityLevelFunction:OnLevelFail() UnityEngine.Time.timeScale = 1 local hpDiff = FP.newV1(0) local myEntityList = LevelPlayerManager.GetPlayerEntitysByPlayerIDInRoom(LuaConst.STANDALONE_PLAYER_PlayID) for i,entity in ipairs(myEntityList) do hpDiff:Add(entity.components.attr:HitPointPercents()) end local enemyEntityList = LevelPlayerManager.GetPlayerEntitysByPlayerIDInRoom(LuaConst.STANDALONE_ENEMYPLAYER1_PLAYID) for i,entity in ipairs(enemyEntityList) do hpDiff:Sub(entity.components.attr:HitPointPercents()) end if hpDiff > FP.Const.Zero then self:OnLevelSucceed(false) else Base.OnLevelFail(self) end end return ExpAttackCityLevelFunction