Exemple #1
0
 void Update()
 {
     animator.SetBool("isAlive", alive);
     if (alive)
     {
         if (transform.position.y < LevelConfiguration.GetInstance().deathVerticalLevel)
         {
             hitPoints = 0;
             HandleDead();
         }
     }
 }
Exemple #2
0
 void OnDead()
 {
     if (lives > 0)
     {
         // Respawn
         alive              = true;
         hitPoints          = maxHitpoints;
         rigidbody.velocity = Vector2.zero;
         transform.position = spawnPoint;
     }
     else
     {
         LevelConfiguration.GetInstance().OnGameOver();
     }
 }