Exemplo n.º 1
0
 public void InvokeTimeChangeCallback()
 {
     if (OnTimeChange != null)
     {
         OnTimeChange.Invoke();
     }
 }
Exemplo n.º 2
0
    public override void OnUpdate()
    {
        if (gameStateManager.currentStateType != GameStateType.InGame)
        {
            return;
        }

        CurrentTimeMode.OnUpdate();
        OnTimeChange?.Invoke(CurrentTimeMode.CurrentTime);
    }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
 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();
     }
 }
Exemplo n.º 5
0
    private IEnumerator StartCountdown()
    {
        _currSeconds = seconds;

        while (_currSeconds >= 0)
        {
            OnTimeChange.Invoke(_currSeconds);
            yield return(new WaitForSeconds(1.0f));

            _currSeconds--;
        }

        NoTimeLeft.Invoke();
        yield return(null);
    }
Exemplo n.º 6
0
    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;
        }
    }
Exemplo n.º 7
0
 private void OnTimerTick(object sender, EventArgs eventArgs) => OnTimeChange?.Invoke(sender, eventArgs);
Exemplo n.º 8
0
 public void Increase(double increment)
 {
     Assert.IsTrue(increment >= 0, "Attempted to increment time negatively.");
     time += increment;
     OnTimeChange?.Invoke();
 }
Exemplo n.º 9
0
 public static void FireTimeChange(float time)
 {
     OnTimeChange?.Invoke(time);
 }