--速度 local SwitchTimeSystem = {} local LuaConst=LuaConst function SwitchTimeSystem.OnLogicUpdate(entity) local recordComponent = entity.components.record local swTimer = recordComponent.SwitchTimer if swTimer > 0 then swTimer = swTimer - LuaConst.TimeSpanMs if swTimer <= 0 then swTimer = -1 end --TODO 这个计时器不应该放在逻辑层,应该只在UI层面去做计时表现的Tick逻辑只检测间隔 --EventSystem.Dispatch(EventID.UIBattle_PlayerBattleHUD_UpdateSwitchTime, swTimer, entity._logicInitData.CharacterID) recordComponent.SwitchTimer = swTimer end end function SwitchTimeSystem.OnSwitchHero(fromEntity,toentity) local recordComponent = toentity.components.record recordComponent.SwitchTimer = BattleDataGetter.GetSwitchHeroCD() if GlobalBattleData.Get_IsSkillNoCD() then recordComponent.SwitchTimer = 0 end fromEntity.components.record.SwitchTimer = -1 end function SwitchTimeSystem.OnRevive(entity) entity.components.record.SwitchTimer = 0 end return SwitchTimeSystem