public void InvokeTimeChangeCallback() { if (OnTimeChange != null) { OnTimeChange.Invoke(); } }
public override void OnUpdate() { if (gameStateManager.currentStateType != GameStateType.InGame) { return; } CurrentTimeMode.OnUpdate(); OnTimeChange?.Invoke(CurrentTimeMode.CurrentTime); }
public void StartNewSequence(Sequence newSequence, bool startFromBeginning = true) { timeMin = newSequence.minTime; timeMax = newSequence.maxTime; timeStart = newSequence.startTime; timeEnd = newSequence.endTime; time = startFromBeginning ? newSequence.startTime : newSequence.startReversedTime; OnTimeUpdate?.Invoke(time); OnTimeChange?.Invoke(time); }
public void IncreaseTime(int amount) { if (time + amount <= timeMax) { time += amount; Game.SoundPlayer.Play(rearrangeClip, null, volume: 0.25f, randomPitchRange: 0.5f); OnTimeUpdate?.Invoke(time); OnTimeChange?.Invoke(time); } else if (time + amount >= timeMax) { Debug.Log("time: " + time + " +" + amount + " = " + (time + amount) + " / " + timeMax); Game.SequenceHandler.TryPlayAfter(); } }
private IEnumerator StartCountdown() { _currSeconds = seconds; while (_currSeconds >= 0) { OnTimeChange.Invoke(_currSeconds); yield return(new WaitForSeconds(1.0f)); _currSeconds--; } NoTimeLeft.Invoke(); yield return(null); }
private void SetTime() { var timeRemaining = (float)_time.Minutes * 60 + _time.Seconds; UpdateTimer(); if (timeRemaining < 0) { var timeContainer = new TimeContainer(); OnTimeChange?.Invoke(timeContainer); OnFinish?.Invoke(); } DOVirtual.DelayedCall(1, UpdateTimer).SetLoops((int)timeRemaining + 1); void UpdateTimer() { // var fromMinutes = TimeSpan.FromMinutes(timeRemaining); int minutes = Mathf.FloorToInt(timeRemaining / 60); int seconds = Mathf.FloorToInt(timeRemaining % 60); var timeContainer = new TimeContainer { Minutes = minutes, Seconds = seconds }; OnTimeChange?.Invoke(timeContainer); if (timeRemaining <= 0) { OnFinish?.Invoke(); } timeRemaining -= 1; } }
private void OnTimerTick(object sender, EventArgs eventArgs) => OnTimeChange?.Invoke(sender, eventArgs);
public void Increase(double increment) { Assert.IsTrue(increment >= 0, "Attempted to increment time negatively."); time += increment; OnTimeChange?.Invoke(); }
public static void FireTimeChange(float time) { OnTimeChange?.Invoke(time); }