Пример #1
0
    public void GetScoreList()
    {
        entryContainer = transform.Find("highscoreEntryContainer");
        foreach (Transform t in entryContainer)
        {
            GameObject.Destroy(t.gameObject);
        }
        entryTemplate.gameObject.SetActive(false);

        if (Highscores.Get(0).time == 0)
        {
            // There's no stored table, initialize
            Debug.Log("Initializing table with default values...");
            AddHighscoreEntry(2005001, "Nik");
            AddHighscoreEntry(1010002, "CPU");
            AddHighscoreEntry(0040003, "CP2");
        }

        highscoreEntryTransformList = new List <Transform>();
        for (int i = 0; i < Highscores.Count; i++)
        {
            HighscoreEntry highscoreEntry = Highscores.Get(i);
            CreateHighscoreEntryTransform(highscoreEntry, entryContainer, highscoreEntryTransformList);
        }
    }
Пример #2
0
    public void Awake()
    {
        Scene currentScene = SceneManager.GetActiveScene();

        print(currentScene.name);
        LevelNameSelect = LevelNSelect.ToString();
        print(LevelNameSelect);
        entryContainer = transform.Find("highscoreEntryContainer");

        entryTemplate.gameObject.SetActive(false);

        if (Highscores.Get(0).time == 0)
        {
            // There's no stored table, initialize
            Debug.Log("Initializing table with default values...");
            AddHighscoreEntry(2005001, "Nik");
            AddHighscoreEntry(1010002, "CPU");
            AddHighscoreEntry(0040003, "CP2");
        }

        highscoreEntryTransformList = new List <Transform>();
        for (int i = 0; i < Highscores.Count; i++)
        {
            HighscoreEntry highscoreEntry = Highscores.Get(i);
            CreateHighscoreEntryTransform(highscoreEntry, entryContainer, highscoreEntryTransformList);
        }
    }
Пример #3
0
    //string PrefsbrakeUp;
    void Start()
    {
        //PlayerPrefs.DeleteAll();


        Highscores.Load();
        string currentPlayerName = PlayerPrefs.GetString("CurrentPlayerName");

        //Debug.Log(Highscores.Load());
        HighscoretableOn.SetActive(false);
        //		string name = SceneManager.GetActiveScene().name;
        //
        //		Debug.Log("Loading "+name);
        //		name += "Highscore";
        BestText.text = Highscores.Get(0).time.ToString("00:00:000");
        //
        WorstText.text   = Highscores.Get(2).time.ToString("00:00:000");
        timeCounter.text = ("00:00:000");
        GameObject.Find("GameObject").GetComponent <Controll_objects_Right_Left>().enabled = false;

        LevelCount.text = "LEVEL:" + SceneManager.GetActiveScene().buildIndex.ToString();        //buildIndex.ToString();
        gamePlaying     = false;
        BeginGame();
        StartCoroutine(CountdownToStart());
        ActiveMenu        = false;
        ActiveOptionsMenu = false;
        PauseMenu1.SetActive(false);
        OptionsMenu1.SetActive(false);
        NextLevelbutton.SetActive(false);
        EndGameButton.SetActive(false);
        //EndGameObject.SetActive(false);
        Time.timeScale = 1;

        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        //print (currentScen)
        if (sceneName == "LVL_006")         //of het laatst levelnr
        {
            EndGameObject.SetActive(true);
        }

//		if (sceneName == "LVL_008") //of het laatst levelnr
//		{
//
//			PlayerPrefs.DeleteKey("HighScore1" + SceneManager.GetActiveScene());
//			PlayerPrefs.DeleteKey("HighScore2" + SceneManager.GetActiveScene());
//			PlayerPrefs.DeleteKey("HighScore3" + SceneManager.GetActiveScene());
//			PlayerPrefs.DeleteKey("HighScore1");
//		}
    }
Пример #4
0
    public void AddHighscoreEntry(int time, string name)
    {
        Highscores.Add(time, name);
        Highscores.Save();

        foreach (Transform t in entryContainer.transform)
        {
            GameObject.Destroy(t.gameObject);
        }
        highscoreEntryTransformList = new List <Transform>();
        for (int i = 0; i < Highscores.Count; i++)
        {
            HighscoreEntry highscoreEntry = Highscores.Get(i);
            CreateHighscoreEntryTransform(highscoreEntry, entryContainer, highscoreEntryTransformList);
        }
    }