Esempio n. 1
0
 private void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.gameObject.tag == "attacker")
     {
         TookDamage?.Invoke();
         GetComponent <SpriteRenderer>().sprite = FacesAfterHit[noOfTimesHit];
         if (noOfTimesHit + 1 < FacesAfterHit.Length)
         {
             noOfTimesHit++;
         }
     }
     if (collider.gameObject.tag == "heartAttacker")
     {
         LifeLost?.Invoke();
     }
 }
 public static void CallLifeLost(int lives)
 {
     LifeLost?.Invoke(lives);
 }
Esempio n. 3
0
        private void LoseLife()
        {
            --currentLives;

            LifeLost?.Invoke();
        }