private void Update()
 {
     if (!gameEnded && !enemyHealthManager.IsAlive() && OnGameEnd != null)
     {
         Debug.Log("Game finished");
         gameEnded = true;
         OnGameEnd();
     }
 }
예제 #2
0
 private void FixedUpdate()
 {
     animationManager.SetIdle(rb.velocity == Vector2.zero);
     if (!enemyHealthManager.IsAlive())
     {
         rb.velocity = Vector2.zero;
         return;
     }
     if (hasFoundPlayer)
     {
         Attack();
     }
     if (rb.velocity != Vector2.zero)
     {
         direction = rb.velocity;
     }
     Debug.DrawRay(transform.position, direction, Color.red);
     if (invokesDone > invokes && !hasFoundPlayer)
     {
         FindPlayer();
     }
 }