Пример #1
0
    void Awake()
    {
        _powerup        = GetComponent <Powerup>();
        _amountCurrent  = 0;
        _amount         = 0;
        AmountText.text = "0";

        Color acolor = Consts.GET_COLOR_BY_ID(_powerup.GetColor());

        Filler.color    = acolor;
        acolor.r        = Mathf.Max(0, acolor.r - 0.6f);
        acolor.g        = Mathf.Max(0, acolor.g - 0.6f);
        acolor.b        = Mathf.Max(0, acolor.b - 0.6f);
        BackImage.color = acolor;
    }
Пример #2
0
 public int AddMana(int manaToAdd, int color)
 {
     if (Mana.IsFull())
     {
         return(0);
     }
     if (color < 0 || color == _powerup.GetColor())
     {
         int manaToAddReal = Mathf.Min(Mana.GetMaxAmount() - Mana.GetAmount(), manaToAdd);
         int mana          = Mana.GetAmount() + manaToAddReal;
         Mana.SetAmount(mana);
         UpdateReadyMark();
         return(manaToAddReal);
     }
     return(0);
 }
Пример #3
0
 public int AddMana(int manaToAdd, int color)
 {
     if (IsFull())
     {
         return(0);
     }
     if (color < 0 || color == _powerup.GetColor())
     {
         int manaToAddReal = Mathf.Min(_maxAmount - _amount, manaToAdd);
         int mana          = _amount + manaToAddReal;
         mana = Mathf.Max(0, mana);
         mana = Mathf.Min(mana, _maxAmount);
         SetAmount(mana);
         return(manaToAdd - manaToAddReal);
     }
     return(0);
 }