Example #1
0
    public virtual void TakeDamage(int d, Spaceship caster)
    {
        _currentLife -= d;

        if (_LifeUI)
        {
            _LifeUI.LifeChanged();
        }

        if (_currentLife <= 0)
        {
            _currentLife = 0;

            Kill(caster);
        }
    }
Example #2
0
    public virtual void Damage(int d, GameObject caster)
    {
        _life -= d;

        if (_lifeUI)
        {
            _lifeUI.LifeChanged(_life, _maxLife);
        }

        if (_life <= 0)
        {
            _life = 0;

            Explode(caster);
        }
    }