Exemple #1
0
        public bool CapacityRemove(float valueToRemove)
        {
            if (!CanUseCapacity)
            {
                return(false);
            }

            if (!(Capacity - valueToRemove >= Config.MinCapacity))
            {
                return(false);
            }

            Capacity -= valueToRemove;
            OnAttributeCapacityChange?.Invoke(Capacity, Capacity + valueToRemove);

            return(true);
        }
Exemple #2
0
        public bool CapacityAdd(float valueToAdd)
        {
            if (!CanUseCapacity)
            {
                return(false);
            }

            if (!Config.AllowExceedCapacity && !(Capacity + valueToAdd <= Value))
            {
                return(false);
            }

            Capacity += valueToAdd;
            OnAttributeCapacityChange?.Invoke(Capacity, Capacity - valueToAdd);

            return(true);
        }