public void OnPlayerCrash() { if (_gameData.GameType != GameTypeEnum.MultyNew) { _safePlayerPrefs.ChangeTryse(_gameData.GetTryes, _gameData.gameId); } SafeStopCoroutine_Record(); SafeStopCoroutine_Ghost(); if (_gameData.GetTryes < 3) { Zaglushka_CrashAndThenFinish(); CheckWhatWindowShowOnCrash(); } else { BuyTriesQuestion(); } }
// METHODS public void Init(GameData data) { GameDataManager._init.SetGameData(data); _gameData = GameDataManager._init.GameData; if (TryesCount == 0 && _gameData.GameType != GameTypeEnum.MultyNew) { TryesCount = _safePlayerPrefs.GetTryse(_gameData.gameId); _safePlayerPrefs.ChangeTryse(TryesCount, _gameData.gameId); } //Debug.Log("TryesCount Finity " + TryesCount); _gameWindow.InitGameData(_gameData); _gameManager.LoadTrack(OnTrackLoaded); // }
// I_HANDLER #region I_HANDLER_INTERFACES public void Init(GameData data) { GameDataManager._init.SetGameData(data); _gameData = GameDataManager._init.GameData; EventManager._init.Game.TrackEvent.GetEvent.Invoke_Awake(); #region Init //pre-conditions Assert.AreNotEqual(null, data); _carConstructor = Core.Instance.GetService <CarConstructor>(); Assert.AreNotEqual(null, _carConstructor); _gameManager = Core.Instance.GetService <GameManager>(); Assert.AreNotEqual(null, _gameManager); _playerManager = Core.Instance.GetService <PlayerManager>(); Assert.AreNotEqual(null, _playerManager); // _uiManager = Core.Instance.GetService <UIManager>(); Assert.AreNotEqual(null, _uiManager); _gameWindow = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_ASYNC) as GameWindowAsyncMultiplayer; Assert.AreNotEqual(null, _gameWindow); _pauseWindow = _uiManager.GetWindow(UIWindowEnum.PAUSE_ASYNC) as PauseWindow; Assert.AreNotEqual(null, _pauseWindow); _retryWindow = _uiManager.GetWindow(UIWindowEnum.RETRY_ASYNC) as RetryWindow; Assert.AreNotEqual(null, _retryWindow); _crashFinishWindow = _uiManager.GetWindow(UIWindowEnum.CRASH_FINISH_ASYNC) as CrashFinishWindow; Assert.AreNotEqual(null, _crashFinishWindow); _recordFinishPanel = _uiManager.GetWindow(UIWindowEnum.RECORD_FINISH_ASYNC) as RecordFinishPanel; Assert.AreNotEqual(null, _recordFinishPanel); _recordObjectController = Core.Instance.GetService <RecordObjectController>(); Assert.AreNotEqual(null, _recordObjectController); // _audioService = Core.Instance.GetService <AudioService>(); Assert.AreNotEqual(null, _audioService); _stasticService = Core.Instance.GetService <StatisticsService>(); Assert.AreNotEqual(null, _stasticService); _safePlayerPrefs = Core.Instance.GetService <SafePlayerPrefs>(); Assert.AreNotEqual(null, _safePlayerPrefs); _replyObjectController = Core.Instance.GetService <ReplyObjectController>(); _aBaseGameWindow = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_ASYNC) as ABaseGameWindow; #endregion if (_gameData.GetTryes == 0 && _gameData.GameType != GameTypeEnum.MultyNew) { int TryesCount = _safePlayerPrefs.GetTryse(_gameData.gameId); _safePlayerPrefs.ChangeTryse(TryesCount, _gameData.gameId); } _gameWindow.InitGameData(_gameData); _gameManager.LoadTrack(OnTrackLoaded); }