コード例 #1
0
        public void OnPlayerCrash()
        {
            //Debug.Log("OnPlayerCrash");
            // -----------------------------------------------------------------
            // заглушка - чтоб если разбились возле финиша и тушка машины на него заехала
            // то не засчитывали победы в заезде
            if (_calcMetersToEnemy != null)
            {
                Core.Instance.StopCor(_calcMetersToEnemy);
            }

            IsPlayerCrash = true;

            _playerCar.EnablePlayerControll(false);
            EventManager._init.Game.CarEvent.Player.GetEvent.Finish -= OnPlayerFinish;
            //_finishWindow.OnBuyTriesClick += BuyTries;
            _playerCar.ExplosePlayer();
            _gameData.IsFinishedReplay = 0;
            _gameWindow.DeActiveJewels();
            _safePlayerPrefs.SaveEarnedJewels(0);

            TryesCount++;
            TryesCount--;

            if (_gameData.GameType != GameTypeEnum.MultyNew)
            {
                _safePlayerPrefs.ChangeTryse(TryesCount, _gameData.gameId);
            }
            // -----------------------------------------------------------------

            if (TryesCount < 2)
            {
                Core.Instance.StartCor(Wait(1.5f, _retryWindow.Show));
            }
            else
            {
                if (_gameData.IsFinishedEnemy == 1)
                {
                    _gameData.gameResultScore = 0;
                }
                else
                {
                    _gameData.gameResultScore = 2;
                }
                _gameWindow.DeActiveGold();
                Core.Instance.StartCor(Wait(1f, () => {
                    _finishWindow.PriceBuyTryes.text = CountTriesBuy.ToString();
                    _finishWindow.ShowQuestion(() => { if (!IsBuyTries)
                                                       {
                                                           _finishWindow.OnBuyTriesClick -= BuyTries; Core.Instance.StartCor(Wait(0.2f, CalculateResults));
                                                       }
                                               });
                }));
            }
        }
コード例 #2
0
        public void Start()
        {
            //new



            _uiManager.ShowWindow(UIWindowEnum.SPLASH, false);
            _gameWindow.Show();
            //
            _gameData.IsFinishedRecord = 0;

            _recordObjectController.Init();
            _gameWindow.DeActiveJewels();


            //InitTimeInfo();
            _gameWindow.DeActiveGold();



            if (!_playerManager.TrackOpen.Contains(Convert.ToInt32(_gameData.track_id) + 1))
            {
                //coroutineStartTimeInfo = Core.Instance.StartCor(СheckTimeInfo());
            }

            Debug.Log("Tryes in Start " + _gameData.GetTryes);
            _coroutineStartTimer = Core.Instance.StartCor(
                StartTimer(
                    _gameWindow,

                    () => {
                if (_gameData.GetTryes <= 0)
                {
                    //_finishWindow.OnBuyTriesClick += BuyTries;

                    _playerCar.EnablePlayerControll(false);
                    CalculateResults();
                    if (_coroutineStartTimer != null)
                    {
                        Core.Instance.StopCor(_coroutineStartTimer);
                    }
                }

                _coroutineRecord = Core.Instance.StartCor(Record());
                if (_replayData.Count > 0)
                {
                    _coroutineGhost = Core.Instance.StartCor(MoveGhost());
                }
                EventManager._init.Game.TrackEvent.GetEvent.Invoke_Start();
            }
                    )
                );
        }