Ejemplo n.º 1
0
 private void SwitchToShootingAtPlayer()
 {
     if (
         SoldierAIBehaviorUtil.PlayerInSightButNoObstaclesBetween(this.PlayerObjectStateDataSystem, this.WeaponFiringAreaSystem) &&
         Vector3.Distance(this.PlayerObjectStateDataSystem.PlayerObject().InteractiveGameObject.GetTransform().WorldPosition, this.AssociatedInteractiveObject.InteractiveGameObject.GetTransform().WorldPosition)
         <= this.SoldierAIBehaviorDefinition.MaxDistancePlayerCatchUp)
     {
         Debug.Log(MyLog.Format("MoveTowardsPlayerStateManager to GO_ROUND_PLAYER"));
         this.TrackAndKillAIbehaviorRef.SetState(TrackAndKillPlayerStateEnum.SHOOTING_AT_PLAYER);
     }
 }
Ejemplo n.º 2
0
 public override void Tick(float d)
 {
     //If the PlayerObject is seen and can shoot.
     if (SoldierAIBehaviorUtil.PlayerInSightButNoObstaclesBetween(this.PlayerObjectStateDataSystem, this.WeaponFiringAreaSystem))
     {
         Debug.Log(MyLog.Format("MoveAroundPlayerStateManager to SHOOTING_AT_PLAYER"));
         this._trackAndKillPlayerStateBehaviorRef.SetState(TrackAndKillPlayerStateEnum.SHOOTING_AT_PLAYER);
     }
     /// Else, we keep moving to the destination
     /// Destination is cached, so no calculation every frame
     else
     {
         this.ISetAIAgentDestinationActionCallback.SetAIAgentSpeedAttenuationAction.Invoke(AIMovementSpeedAttenuationFactor.RUN);
         this.ISetAIAgentDestinationActionCallback.SetAIAgentDestinationAction.Invoke(this.CalculatedLookingAtAgentMovementCalculationStrategy);
     }
 }