예제 #1
0
        private void Awake()
        {
            _settingsProvider = new PlayerPrefsSettingProvider();
#if UNITY_EDITOR || UNITY_STANDALONE
            _inputService = new KeyboardInput();
#elif (UNITY_ANDROID || UNITY_IOS)
            _inputService = new MobileInput();
#endif
            CreateBall();
            CreateRackets();

            _scoreCounter          = new ScoreCounter.ScoreCounter();
            _ball.OnBallHitRacket += _scoreCounter.IncrementScore;
            _ball.OnBallRestart   += _scoreCounter.ResetScore;

            _scoreCounterText             = new ScoreCounterText(scoreCounterTextGo);
            _scoreCounter.OnScoreUpdated += _scoreCounterText.UpdateScore;

            _bestScoreUpdater             = new BestScoreUpdater(_settingsProvider);
            _scoreCounter.OnScoreUpdated += _bestScoreUpdater.UpdateScore;
            _ball.OnBallRestart          += _bestScoreUpdater.SaveToDisk;

            _bestScoreCounterText = new ScoreCounterText(bestScoreCounterTextGo, _settingsProvider.GetBestScore());
            _bestScoreUpdater.OnBestScoreUpdated += _bestScoreCounterText.UpdateScore;
        }
예제 #2
0
 public void BeforeEachTest()
 {
     _text             = new GameObject().AddComponent <Text>();
     _text.text        = "0";
     _scoreCounterText = new ScoreCounterText(_text);
 }