public void ToAimState()
 {
     //if enemy is to close run away, (and then aim again)not done here
     if (enemy.IsPlayerInsideComfortZone())
     {
         enemy.currentState = enemy.retreatState;
     }
     else
     {
         attackState.currentAttackState = attackState.aimState;
     }
 }
 public void UpdateState()
 {
     // Debug.Log("Damn you too close for me man");
     //DONT DO IN UPDATE CHECK ONCE THEN MOVE TO THAT POINT <<<<<note self optimize later perhaps
     if (enemy.IsPlayerInsideComfortZone())//if player is NOT in i safe, and i aim again
     {
         RetreatOnNavmesh(GetPointToRetreatTo());
     }
     else
     {
         ToAttackState();
     }
 }
示例#3
0
 void Fire()
 {
     if (!enemy.IsPlayerInsideComfortZone())
     {
         Vector3 directionToPlayerWithOffset = enemy.GetDirectionTo(enemy.chaseTarget);
         directionToPlayerWithOffset = new Vector3(directionToPlayerWithOffset.x, directionToPlayerWithOffset.y + 0.10f, directionToPlayerWithOffset.z);
         SpawnProjectile(enemy.transform.position, directionToPlayerWithOffset, enemy.projectileSpeed);
         Debug.Log("lets say i jsut fired");
         enemy.isReloaded = false;
         ToAttackWindUp();
     }
     else
     {
         ToAttackWindUp();
         enemy.currentState = enemy.retreatState;
     }
 }