Beispiel #1
0
 public void StopRewind()
 {
     canRewind = false;
     rewinding = false;
     timer     = 0;
     OnRewindEnd?.Invoke();
     Timer.StartTimer(REWIND_COOLDOWN, () => canRewind = true);
 }
Beispiel #2
0
 IEnumerator RewindTween()
 {
     timer = 0;
     while (timer < duration)
     {
         timer       += Time.deltaTime;
         target.color = Color.Lerp(targetColor, startingColor, timer / duration);
         yield return(null);
     }
     OnRewindEnd.Invoke();
 }
 IEnumerator TweenRewind()
 {
     timer = 0;
     while (timer < duration)
     {
         timer            += Time.deltaTime;
         target.localScale = Vector3.Lerp(targetScale, startingScale, timer / duration);
         OnTweenUpdate.Invoke();
         yield return(null);
     }
     OnRewindEnd.Invoke();
 }
    private IEnumerator TriggerLevelFinishCoroutine()
    {
        _score++;
        OnLevelFinish?.Invoke();
        yield return(new WaitForSeconds(_timeUntilRewindInMs / 1000f));

        OnRewindBegin?.Invoke(_rewindDurationInMs);
        //AudioSettings.Instance.BasePitch = -1f; // Does not work in web build...
        yield return(new WaitForSeconds(_rewindDurationInMs / 1000f));

        OnRewindEnd?.Invoke();
        AudioSettings.Instance.BasePitch = 1;

        StartMainLoop();
    }