Example #1
0
        }//onStaminaRestore

        public void UpdateStamina(float byAmount)
        {
            this.Status += byAmount;
            if (Mathf.Sign(byAmount) < 0 && this.Status > 0)
            {
                ResetFlags();
            }

            if (this.Status > Amount)
            {
                EOnFullyRestored?.Invoke();
                Reset();
            }
            if (this.Status < 0)
            {
                this.Status         = 0;
                this.IsFullyDrained = true;
                this.timeOfDrained  = Time.timeSinceLevelLoad;
                EOnFullyDrained?.Invoke();
            }

            if (Mathf.Sign(byAmount) < 0)
            {
                this.timeOfLastStaminaUpdate = Time.timeSinceLevelLoad;
            }


            EOnStaminaUpdated?.Invoke(this.Status);
        }//UpdateStamina