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);
 }
Esempio n. 3
0
 private void DoAttack(OrcStateMachine stateMachine)
 {
     stateMachine.SetPursuitAnim(false);
     if (!stateMachine.enemy.conditions.isAttacking)
     {
         stateMachine.transform.LookAt(GameManager.Instance.player.transform.position);
         GameManager.Instance.soundManager.Play("OrcAttack");
         stateMachine.SetTriggerAttackAnim();
         stateMachine.enemy.conditions.isAttacking = true;
     }
     if (Vector3.Distance(stateMachine.navAgent.transform.position, GameManager.Instance.player.transform.position) > stateMachine.enemy.stats.AttackRange)
     {
         stateMachine.enemy.conditions.isAttackRange = false;
         stateMachine.enemy.conditions.isChasing     = true;
         stateMachine.enemy.conditions.isAttacking   = false;
     }
 }