private void DoPursuit(OrcStateMachine stateMachine)
 {
     stateMachine.LookPlayer();
     stateMachine.enemy.stats.Spd           = 4f;
     stateMachine.navAgent.speed            = stateMachine.enemy.stats.Spd;
     stateMachine.navAgent.stoppingDistance = 3f;
     stateMachine.navAgent.isStopped        = false;
     if (stateMachine.navAgent.destination != GameManager.Instance.player.transform.position)
     {
         stateMachine.navAgent.SetDestination(GameManager.Instance.player.transform.position);
         stateMachine.SetPatrolAnim(false);
         stateMachine.SetPursuitAnim(true);
     }
     if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) <= stateMachine.navAgent.stoppingDistance)
     {
         stateMachine.enemy.conditions.isAttackRange = true;
         stateMachine.enemy.conditions.isChasing     = false;
     }
     if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) >= stateMachine.enemy.stats.PursuitRange)
     {
         stateMachine.enemy.conditions.isPatrol       = true;
         stateMachine.enemy.conditions.isChasing      = false;
         stateMachine.enemy.conditions.isPursuitRange = false;
     }
     if (!stateMachine.isSpinCorrRunning)
     {
         stateMachine.enemy.conditions.canSpinAttack = true;
     }
 }
Esempio n. 2
0
 private void DoPatrol(OrcStateMachine stateMachine)
 {
     stateMachine.navAgent.stoppingDistance = 1.5f;
     stateMachine.enemy.stats.Spd           = 2f;
     stateMachine.navAgent.speed            = stateMachine.enemy.stats.Spd;
     stateMachine.SetPursuitAnim(false);
     stateMachine.SetPatrolAnim(true);
     stateMachine.navAgent.SetDestination(stateMachine.patrolTarget.position);
 }