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 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(); } }