public void CheckCanAddOne() { if (_timeBasedValue.GetTimeToNextAdd() >= TimeSpan.Zero) { EnergySuiteManager.OnTimeLeftChanged(_timeBasedValue.GetTimeToNextAdd(), _timeBasedValue); } else { _energySuiteValueBehaviour.Add(1); EnergySuiteManager.OnTimeLeftChanged(_timeBasedValue.GetTimeToNextAdd(), _timeBasedValue); } }
public void Add(int amount) { if (Amount + amount <= MaxAmount) { Amount += amount; } else { Amount = MaxAmount; } EnergySuiteManager.OnAmountChanged(Amount, this); }
public bool Use(int amount) { if (Amount - amount >= 0) { Amount -= amount; } else { return(false); } EnergySuiteManager.OnAmountChanged(Amount, this); return(true); }
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; } }
void UseLifeButtonClicked() { EnergySuiteManager.Use(TimeValue.Life, 1); }
void AddLifeButtonClicked() { EnergySuiteManager.Add(TimeValue.Life, 1); }
void UseKeyButtonClicked() { EnergySuiteManager.Use(TimeValue.Key, 1); }
void AddKeyButtonClicked() { EnergySuiteManager.Add(TimeValue.Key, 1); }
void Start() { CurrentLifeAmountText.text = EnergySuiteManager.GetAmount(TimeValue.Life) + "/" + EnergySuiteManager.GetMaxAmount(TimeValue.Life); CurrentKeyAmountText.text = EnergySuiteManager.GetAmount(TimeValue.Key) + "/" + EnergySuiteManager.GetMaxAmount(TimeValue.Key); }