Пример #1
0
    protected override void SetHealthStatus()
    {
        if (isShieldUp)
        {
            if (realDamage <= shieldPoint)
            {
                shieldPoint -= realDamage;
                hpReduction  = 0;
            }
            else if (realDamage < hp + shieldPoint)
            {
                hp          = hp + shieldPoint - realDamage;
                hpReduction = realDamage - shieldPoint;
                shieldPoint = 0;
            }
            else
            {
                hpReduction = hp;
                hp          = 0;
                shieldPoint = 0;
            }
        }
        else
        {
            if (hp < realDamage)
            {
                hpReduction = hp;
                hp          = 0;
            }
            else
            {
                hpReduction = realDamage;
                hp         -= realDamage;
            }
        }

        if (shieldPoint == 0)
        {
            ShieldDown();
        }
        if (hp == 0)
        {
            isDead = true;
            movementComponent.SetIsDead(true);
        }
    }