protected override void OnTick(
     Func <Agent, bool> isAgentManagedByThisMachineAI,
     Team potentialUsersTeam,
     float dt)
 {
     base.OnTick(isAgentManagedByThisMachineAI, potentialUsersTeam, dt);
     if (this.UsableMachine.PilotAgent != null && this.UsableMachine.PilotAgent.IsAIControlled)
     {
         RangedSiegeWeapon usableMachine = this.UsableMachine as RangedSiegeWeapon;
         if (usableMachine.State == RangedSiegeWeapon.WeaponState.WaitingAfterShooting && usableMachine.PilotAgent != null && usableMachine.PilotAgent.IsAIControlled)
         {
             usableMachine.ManualReload();
         }
         if ((double)dt > 0.0 && this._target == null && usableMachine.State == RangedSiegeWeapon.WeaponState.Idle)
         {
             if ((double)this._delayTimer <= 0.0)
             {
                 this.FindNextTarget();
             }
             this._delayTimer -= dt;
         }
         if (this._target != null)
         {
             if (this._target.Agent != null && !this._target.Agent.IsActive())
             {
                 this._target = (Threat)null;
                 return;
             }
             if (usableMachine.State == RangedSiegeWeapon.WeaponState.Idle && usableMachine.UserCount > 0)
             {
                 if (DebugSiegeBehaviour.ToggleTargetDebug)
                 {
                     Agent pilotAgent = this.UsableMachine.PilotAgent;
                 }
                 if (this._targetEvaluationTimer.Check(MBCommon.GetTime(MBCommon.TimeType.Mission)) && !(this.UsableMachine as RangedSiegeWeapon).CanShootAtBox(this._target.BoundingBoxMin, this._target.BoundingBoxMax))
                 {
                     ++this._cannotShootCounter;
                 }
                 if (this._cannotShootCounter < 4)
                 {
                     if (usableMachine.AimAtTarget(this._target.Position) && usableMachine.PilotAgent != null)
                     {
                         this._delayTimer -= dt;
                         if ((double)this._delayTimer <= 0.0)
                         {
                             usableMachine.Shoot();
                             this._target = (Threat)null;
                             this.SetTargetingTimer();
                             this._cannotShootCounter = 0;
                             this._targetEvaluationTimer.Reset(MBCommon.GetTime(MBCommon.TimeType.Mission));
                         }
                     }
                 }
                 else
                 {
                     this._target = (Threat)null;
                     this.SetTargetingTimer();
                     this._cannotShootCounter = 0;
                 }
             }
             else
             {
                 this._targetEvaluationTimer.Reset(MBCommon.GetTime(MBCommon.TimeType.Mission));
             }
         }
     }
     this.AfterTick(isAgentManagedByThisMachineAI, potentialUsersTeam, dt);
 }