private void Start() { button = gameObject.GetComponent <Button>(); button.onClick.AddListener(Press); GameStatus.Save(); ScoreTable.SaveScores(); }
private void Update() { //Debug.Log("CurrentLevel: " + currentLevel); if (Input.GetKey(KeyCode.Escape)) { if (inLevel) { ScoreTable.SaveScores(); Save(); } SceneManager.LoadScene("MainMenu"); } if (!theGameIsOn) { Time.timeScale = 0; } else { Time.timeScale = 1; } }
public void StartGame() { if (textField.text.Length > 0 && !PlayerPrefs.HasKey(textField.text)) { GameStatus.gameBegin = true; PlayerPrefs.SetString(textField.text, textField.text); PlayerPrefs.SetInt(textField.text + "levels", 1); PlayerPrefs.SetInt(textField.text + "scores", 0); //testing ways to do highscore ScoreTable.SetScore(textField.text, "level", 1); ScoreTable.SetScore(textField.text, "score", 0); ScoreTable.currentPlayer = textField.text; ScoreTable.SaveScores(); Debug.Log("New Challenger! Name: " + textField.text + " Level: " + ScoreTable.GetScore(textField.text, "level") + ", Score: " + ScoreTable.GetScore(textField.text, "score")); SceneManager.LoadScene("Map"); } else if (PlayerPrefs.HasKey(textField.text)) { ScoreTable.currentPlayer = textField.text; Debug.Log(PlayerPrefs.GetString(textField.text)); ScoreTable.LoadScores(); SceneManager.LoadScene("Map"); } }