void OnTriggerEnter(Collider other) { if (other.CompareTag("PlayerBullet")) { other.GetComponent <FlightPlayerBullet>().Damage(); life--; if (life <= 0) { gameManager.OnFairyDeath(score * 2); Die(); } } else if (other.CompareTag("Player")) { gameManager.OnFairyDeath(score); Die(); other.GetComponent <Dragon>().Damage(1); } }
protected void Damage() { if (invulTimeLeft > 0) { return; } OnDamage(); invulTimeLeft = invulnurabilityTime; life--; if ((interruptOnDamage) || (interruptWhenHealthEquals == life) || (life == healthAtLastInterrupt - interruptWhenHealthLoweredBy)) { interrupt = true; healthAtLastInterrupt = life; } if (life <= 0) { gameManager.OnFairyDeath(score * 2); Die(); } }