예제 #1
0
    public void AbsorbDamage(int damage)
    {
        if (shieldLevel == 0)
        {
            Debug.LogWarning("Shield with 0 level is trying to absorb damage");
            return;
        }

        if ((ship.GetShieldPower() - damage) < 0)
        {
            ship.DecreaseShieldLevel();
            ResetShieldLevel();
        }
        else if ((ship.GetShieldPower() - damage) == 0)
        {
            ship.TakeShieldPower(damage);
            ResetShieldLevel();
        }
        else
        {
            ship.TakeShieldPower(damage);
        }
    }