Esempio n. 1
0
 public void CheckCanAddOne()
 {
     if (_timeBasedValue.GetTimeToNextAdd() >= TimeSpan.Zero)
     {
         EnergySuiteManager.OnTimeLeftChanged(_timeBasedValue.GetTimeToNextAdd(), _timeBasedValue);
     }
     else
     {
         _energySuiteValueBehaviour.Add(1);
         EnergySuiteManager.OnTimeLeftChanged(_timeBasedValue.GetTimeToNextAdd(), _timeBasedValue);
     }
 }
Esempio n. 2
0
        public void Add(int amount)
        {
            if (Amount + amount <= MaxAmount)
            {
                Amount += amount;
            }
            else
            {
                Amount = MaxAmount;
            }

            EnergySuiteManager.OnAmountChanged(Amount, this);
        }
Esempio n. 3
0
        public bool Use(int amount)
        {
            if (Amount - amount >= 0)
            {
                Amount -= amount;
            }
            else
            {
                return(false);
            }

            EnergySuiteManager.OnAmountChanged(Amount, this);
            return(true);
        }
Esempio n. 4
0
        void OnTimeLeftChanged(TimeSpan timeLeft, TimeBasedValue timeBasedValue)
        {
            string formatString = string.Format("{0:00}:{1:00}", timeLeft.Minutes, timeLeft.Seconds);
            float  sliderValue  = EnergySuiteManager.ConvertToSliderValue(timeLeft, timeBasedValue);

            switch (timeBasedValue.Type)
            {
            case TimeValue.Life:
                LifeTimeLeftText.text    = formatString;
                LifeTimeLeftSlider.value = sliderValue;
                break;

            case TimeValue.Key:
                KeyTimeLeftText.text    = formatString;
                KeyTimeLeftSlider.value = sliderValue;
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
 void UseLifeButtonClicked()
 {
     EnergySuiteManager.Use(TimeValue.Life, 1);
 }
Esempio n. 6
0
 void AddLifeButtonClicked()
 {
     EnergySuiteManager.Add(TimeValue.Life, 1);
 }
Esempio n. 7
0
 void UseKeyButtonClicked()
 {
     EnergySuiteManager.Use(TimeValue.Key, 1);
 }
Esempio n. 8
0
 void AddKeyButtonClicked()
 {
     EnergySuiteManager.Add(TimeValue.Key, 1);
 }
Esempio n. 9
0
 void Start()
 {
     CurrentLifeAmountText.text = EnergySuiteManager.GetAmount(TimeValue.Life) + "/" + EnergySuiteManager.GetMaxAmount(TimeValue.Life);
     CurrentKeyAmountText.text  = EnergySuiteManager.GetAmount(TimeValue.Key) + "/" + EnergySuiteManager.GetMaxAmount(TimeValue.Key);
 }