Esempio n. 1
0
    public void ResetStats()
    {
        PlayerPrefController.SetHighScore(0);
        PlayerPrefController.SetBestTime(0);

        MainMenuController mainMenu = GameObject.FindObjectOfType <MainMenuController> ();

        mainMenu.UpdateBestScore();
    }
Esempio n. 2
0
 private void Awake()
 {
     if (PlayerPrefController.GetInitialGameStatus() != 1)
     {
         PlayerPrefController.SetHighScore(0);
         PlayerPrefController.SetBestTime(0);
         PlayerPrefController.SetVolume(0.4f);
         PlayerPrefController.SetInitialGameStatus(1);
     }
 }
Esempio n. 3
0
    public void GameOver()
    {
        // Calculate score for this particular run and add it to the existing score
        int waveMultiplier = 1 + (1 / currentWave);

        score += (int)currentTime * waveMultiplier;

        // Compare score & time to current (local) high score & time
        if (score >= PlayerPrefController.GetHighScore())
        {
            PlayerPrefController.SetHighScore(score);
        }

        if (Time.timeSinceLevelLoad > PlayerPrefController.GetBestTime())
        {
            PlayerPrefController.SetBestTime((int)Time.timeSinceLevelLoad);
        }

        playerLost = true;

        // If the current run time was better than the last attempt (or it is run #1), player can continue
        if (kinGeneration > 1 && currentTime < lastKinTime)
        {
            kinAvailable = false;
        }
        else
        {
            kinAvailable = true;
        }

        lastKinTime = currentTime;

        // Fixing bug with camera getting stuck mid-shake
        if (cameraShake.shakeAmount > 0)
        {
            cameraShake.shakeAmount = 0;
            //cameraShake.ShakeCamera ();
        }

        playerStats.skillPoints = currentWave - 1;

        ResetGameGrid();
        uiController.ShowGameOverScreen(kinAvailable);
    }