Beispiel #1
0
    public void EndGame()
    {
        Debug.Log("Game.EndGame");

        var total = World.Game.GameTime;
        var best  = PlayerPrefs.GetFloat("BestTime");

        Debug.LogFormat("Current {0}, best {1}", total, best);

        if (total < best || best == 0)
        {
            // add a final record as we enter last gate
            Player.GetComponent <Recorder>().TakeSample(null);

            // TODO: show a splash screen about best time
            Debug.LogWarning("Best Time! " + total);

            PlayerPrefs.SetFloat("BestTime", total);
            PlayerPrefs.SetString("BestGhostRace", World.Player.GetComponent <Recorder>().SerialiseToString());
        }

        // go back to title screen.
        World.ActivateGame(false);
    }