Example #1
0
        private void Awake()
        {
            SaveGameData data = SaveGameController.LoadGame();

            shotsText.text  = data.Shots.ToString("00");
            pointsText.text = data.Points.ToString("00");

            string minutes = ((int)data.Time / 60).ToString("00");
            string seconds = (data.Time % 60).ToString("00");

            timerText.text = minutes + ":" + seconds;
        }
        private void OnPlayerScored()
        {
            pointsReference.Value++;

            ResetHittenBallsList();

            if (pointsReference.Value == pointsToWin)
            {
                onGameOver.Raise();
                audioController.GameOverSoundClip();

                SaveGameData newSaveData = new SaveGameData()
                {
                    Shots  = shotsReference.Value,
                    Points = pointsReference.Value,
                    Time   = playTimeReference.Value,
                };

                SaveGameController.SaveGame(newSaveData);
            }
        }