Beispiel #1
0
        private protected override void InternalStopGame(bool isSuccess)
        {
            if (!_isPlaying)
            {
                Debug.LogError("Game is not started yet!");
                return;
            }

            _analyticsDelegate?.GameDidStop(isSuccess, _SceneLevelManager.CurrentLevelIndex);

            if (isSuccess)
            {
                _SceneLevelManager.IterateLevel();
            }

            _isPlaying = false;

            _gameSessionDelegate?.WillStopLevel(_MainSceneRef, LevelSceneRef, isSuccess);
#pragma warning disable CS0618
            WillStopLevel(LevelSceneRef, isSuccess);
#pragma warning restore CS0618

            if (_GameEvents)
            {
                _GameEvents.Trigger(false, isSuccess);
            }
            if (_TutorialManager)
            {
                _TutorialManager.Cancel();
            }
            if (_FakeScene)
            {
                _FakeScene.SetActive(true);
            }
            RefreshLevelNumberText();
            if (_UnloadSceneAfterStop)
            {
                _SceneLevelManager.UnloadCurrentLevel(() =>
                {
                    _gameSessionDelegate?.DidStopLevel(_MainSceneRef, isSuccess);
#pragma warning disable CS0618
                    DidStopLevel(isSuccess);
#pragma warning restore CS0618
                });
            }

            if (StructureManager.Controllers != null)
            {
                foreach (var controller in StructureManager.Controllers)
                {
                    (controller as ControllerGenericBase <TMainSceneRefBase, TLevelSceneRefBase>)?.InternalOnLevelStop();
                }
            }
        }