Пример #1
0
 public void UpdateState()
 {
     Attack();
     if (!PlayerInAttackRange() && enemy.GetAnimationState() != EnemyStateHandler.MyAnimationState.Attack)
     {
         ToChaseState();
     }
 }
Пример #2
0
 protected void Chase()
 {
     if (movementHandler.PathEmpty() || pathRefreshTimer <= 0)
     {
         PathRequestManager.RequestPath(enemy.transform.position, enemy.Player.Get2DPosition(), enemy.gameObject, enemy.UnwalkableLayer, OnPathFound);
         pathRefreshTimer = GameManager.Instance.pathFindingRate;
     }
     else
     {
         pathRefreshTimer -= Time.deltaTime;
     }
     FlipIfNeeded();
     if (enemy.GetAnimationState() != EnemyStateHandler.MyAnimationState.Walk)
     {
         enemy.Anim.SetBool(enemy.WalkingAnimationBool, true);
     }
     movementHandler.MoveAlongPath();
 }