예제 #1
0
    public bool ChangePower(int value)
    {
        int count = 0;

        if (_power + value > _maxPower)
        {
            count  = _maxPower - _power;
            _power = _maxPower;
        }
        else if (_power + value >= 0)
        {
            count   = value;
            _power += value;
        }

        if (count > 0)
        {
            PowerBarRef.AddPower(count);
        }
        else
        {
            PowerBarRef.RemovePower(-count);
        }
        return(count != 0);
    }