public bool ActivateAbility(uint entityID)
        {
            if (!this.deployedTroops.ContainsKey(entityID))
            {
                return(false);
            }
            DeployedTroop deployedTroop = this.deployedTroops[entityID];
            SmartEntity   entity        = deployedTroop.Entity;

            if (entity.StateComp.CurState == EntityState.Dying)
            {
                return(false);
            }
            TroopComponent troopComp = entity.TroopComp;
            TroopAbilityVO abilityVO = troopComp.AbilityVO;

            if (abilityVO == null || (abilityVO.ClipCount == 0 && abilityVO.Duration == 0u))
            {
                return(false);
            }
            deployedTroop.Activated = true;
            troopComp.SetVOData(abilityVO, abilityVO);
            troopComp.IsAbilityModeActive     = true;
            troopComp.UpdateWallAttackerTroop = false;
            ShooterComponent shooterComp = entity.ShooterComp;

            if (shooterComp != null)
            {
                shooterComp.SetVOData(abilityVO);
            }
            this.ResetTargetAndSendEvent(entity, true);
            if (!deployedTroop.EffectsSetup)
            {
                this.SetupAbilityViewEffects(deployedTroop, abilityVO);
                deployedTroop.EffectsSetup = true;
            }
            this.ActivateAbilityViewEffects(deployedTroop, abilityVO);
            if (abilityVO.ClipCount > 0)
            {
                this.StartTrackingShooterClips(deployedTroop, abilityVO.ClipCount);
            }
            else
            {
                deployedTroop.AbilityTimer = Service.Get <SimTimerManager>().CreateSimTimer(abilityVO.Duration, false, new TimerDelegate(this.OnAbilityTimer), deployedTroop);
            }
            return(true);
        }
        private void DeactivateAbility(DeployedTroop deployedTroop)
        {
            if (deployedTroop == null)
            {
                Service.Get <StaRTSLogger>().Error("TroopAbilityConroller.DeactivateAbility: DeployedTroop Null");
                return;
            }
            deployedTroop.AbilityTimer = 0u;
            SmartEntity entity = deployedTroop.Entity;

            if (entity == null)
            {
                Service.Get <StaRTSLogger>().Error("TroopAbilityConroller.DeactivateAbility: SmartEntity troop = Null");
                return;
            }
            TroopComponent troopComp = entity.TroopComp;

            if (troopComp == null)
            {
                Service.Get <StaRTSLogger>().Error("TroopAbilityConroller.DeactivateAbility: troopComp = Null");
                return;
            }
            troopComp.SetVOData(troopComp.OriginalTroopShooterVO, troopComp.OriginalSpeedVO);
            troopComp.IsAbilityModeActive = false;
            ShooterComponent shooterComp = entity.ShooterComp;

            if (shooterComp != null)
            {
                shooterComp.SetVOData(shooterComp.OriginalShooterVO);
            }
            TroopAbilityVO abilityVO = troopComp.AbilityVO;

            if (abilityVO == null)
            {
                Service.Get <StaRTSLogger>().Error("TroopAbilityConroller.DeactivateAbility: TroopAbilityVO abilityVO = Null");
                return;
            }
            this.ResetTargetAndSendEvent(entity, false);
            this.DeactivateAbilityViewEffects(deployedTroop);
            this.StopTrackingShooterClips(deployedTroop);
            deployedTroop.Activated = false;
            this.StartCoolDown(deployedTroop, abilityVO);
        }