Example #1
0
 private void FixedUpdate()
 {
     if (targetPlayer != null && !UtilsPlayers.isAlive(targetPlayer))
     {
         targetPlayer = null;
     }
 }
Example #2
0
 // change pour la target la plus proche si celle ci est vivante
 private void setTargetMinDist(GameObject player1)
 {
     if (UtilsPlayers.isAlive(player1) && // !! pour moi la vérification que players est non nul a été faite avant l'entré dans cette fonction
         (targetPlayer == null ||
          !UtilsPlayers.isAlive(targetPlayer) ||
          !UtilsDistance.isMinDist(this.ennemy, targetPlayer, player1)
         )
         )
     {
         this.targetPlayer = player1;
         setEnemyTargetPlayer();
     }
 }
Example #3
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            if (UtilsPlayers.isAlive(collision.gameObject))
            {
                UtilsPlayers.setAlive(collision.gameObject, false);

                if (collision.gameObject.Equals(target))
                {
                    target = null;
                }
            }
        }
    }