private void Start() { if (_isBusy) { return; } _isBusy = true; InputTools.DisableAllInput(); StartFadingCoroutines(FadingType.FadeIn); WaitForFadingCoroutinesFinish(AfterFinish); void AfterFinish() { InputTools.EnableAllInput(); _isBusy = false; SceneOpened?.Invoke(); } }
public void SwitchToScene(string sceneName, SceneMeta meta = null) { if (_isBusy) { return; } _isBusy = true; InputTools.DisableAllInput(); StartFadingCoroutines(FadingType.FadeOut); WaitForFadingCoroutinesFinish(AfterFinish); void AfterFinish() { SceneMetaCourier.Instance.SceneMeta = meta; SceneManager.LoadScene(sceneName); _isBusy = false; } }
public void SolvePrecisely() { _audioSource.Play(); _isWaitingForSolution = false; StartCoroutine(Routine(OnRoutineFinished)); IEnumerator Routine(Action onFinish = null) { InputTools.DisableAllInput(); if (_figureSet != null) { _figureSet.ShowExactSolution(); } foreach (var figure in _figures) { figure.ShowExactSolution(); } while (IsBusy) { yield return(null); } InputTools.EnableAllInput(); onFinish?.Invoke(); } void OnRoutineFinished() { if (ShouldIncrementProgress) { PlayerProgress.Instance.IncrementLevel(); PlayerProgress.Instance.SetNewLevelAsCurrent(); } LevelSolved?.Invoke(); } }