Ejemplo n.º 1
0
 public void SetAmount(int value)
 {
     if (Capacity == 0)
     {
         amount = 0;
         liquid?.SetFillPercentage(0);
     }
     else
     {
         amount = Math.Max(Math.Min(value, Capacity), 0);
         // liquid is null when OnValidate is called twice before Awake
         // when playing in Editor Mode
         // See: https://forum.unity.com/threads/onvalidate-called-twice-when-pressing-play-in-the-editor.430250/
         float percentage = (float)amount / capacity;
         liquid?.SetFillPercentage(percentage);
     }
     OnAmountChange?.Invoke();
 }
Ejemplo n.º 2
0
 private void SendEvents()
 {
     OnAmountChange.Invoke(currentAmount);
     OnAmount01Change.Invoke(Current01Amount);
 }
Ejemplo n.º 3
0
 public void SetAmount(int amount)
 {
     m_Amount = amount;
     OnAmountChange?.Invoke();
 }
Ejemplo n.º 4
0
 public void ChangeAmount(int amount)
 {
     m_Amount += amount;
     OnAmountChange?.Invoke();
 }