private GameStateData GetGameStateData() { userService.BestScore = sectionService.Points; GameStateData gameState = new GameStateData(sectionService.Points, userService.BestScore); return(gameState); }
private void PlayerController_OnPlayerDies() { GameStateData gameState = GetGameStateData(); sectionService.Points = 0; sectionService.Level = 1; OnGameOver?.Invoke(this, gameState); }
private void GameController_OnGameOver(object sender, GameStateData state) { GameController.OnGameOver -= GameController_OnGameOver; EventSystem.current.firstSelectedGameObject = restartButton.gameObject; gameObject.SetActive(true); scoreText.text = state.score.ToString(); bestScoreText.text = state.bestScore.ToString(); }
private void GameController_OnGameStateChange(object sender, GameStateData e) { scoreDisplayer.SetText(e.score); }