public void DamageTaken(CannonBall cannonBall) { _enemyHealth -= cannonBall.GetDamage(); cannonBall.Hit(); if (_enemyHealth <= 0) { SpawnDrop(); Die(); } }
public void DamageTaken(CannonBall cannonBall) { if (_invincibleCounter <= 0) { _playerHealth -= cannonBall.GetDamage(); cannonBall.Hit(); _invincibleCounter = _invincibleMax; _playerRend.enabled = false; _flashCounter = _flashMax; if (_playerHealth <= 0) { this.gameObject.SetActive(false); _healthBar.gameObject.SetActive(false); _gm.SpawnPlayer(); } } }