Пример #1
0
    public void DamageTaken(CannonBall cannonBall)
    {
        _enemyHealth -= cannonBall.GetDamage();
        cannonBall.Hit();

        if (_enemyHealth <= 0)
        {
            SpawnDrop();
            Die();
        }
    }
Пример #2
0
    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();
            }
        }
    }