private void Start() { m_currentScore = 0; // Initialize m_highScores to 0 if no file exists on Disk PlayerHighScores scores = m_highScoreTracker.LoadScores(); if (scores == null) { for (int i = 0; i < 10; i++) { m_highScores.Add(0); //m_highScores[i] = 0; } } else { m_highScores = scores.HighScores; } if (m_player == null) { m_player = GameObject.FindGameObjectWithTag("Player"); } // We cannot spawn until the initial countdown has finished. So the initial spawnTime needs to take this into account m_nextObstacleSpawnTime = Time.time + GameManager.S.m_countdownLength + m_timeBetweenSpawns; print("Setting Spawn time to: " + m_nextObstacleSpawnTime); // Set Coin spawn time to a ridiculously high number to ensure that all obstacles are spawned first; m_nextCoinFormationSpawnTime = Time.time + 1000f; // Set when we should increase difficulty m_increaseDifficultyTime = Time.time + m_difficultyInterval; }
// Use this for initialization void Start() { playerScores = m_highScoreTracker.LoadScores(); if (playerScores != null) { for (int i = 0; i < playerScores.HighScores.Count; i++) { HighScores[i] = playerScores.HighScores[i]; print(HighScores[i]); } } UpdateHighScoreList(); }