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); }
private void LoseLife() { --currentLives; LifeLost?.Invoke(); }