public void SetupGameObjects() { NewGameButton = GameObject.Find("NewGameButton").GetComponent <Button>(); RestartButton = GameObject.Find("RestartButton").GetComponent <Button>(); ExitButton = GameObject.Find("ExitButton").GetComponent <Button>(); TimerText = GameObject.Find("TimerText").GetComponent <Text>(); HealthText = GameObject.Find("HealthText").GetComponent <Text>(); EnemiesText = GameObject.Find("EnemiesText").GetComponent <Text>(); ScoreText = GameObject.Find("ScoreText").GetComponent <Text>(); GameOverText = GameObject.Find("GameOverText").GetComponent <Text>(); HighscoresText = GameObject.Find("HighscoresText").GetComponent <Text>(); NewGameButton.onClick.AddListener(AsteroidsArcadeBootstrap.NewGame); RestartButton.onClick.AddListener(AsteroidsArcadeBootstrap.RestartGame); ExitButton.onClick.AddListener(() => { #if UNITY_EDITOR EditorApplication.isPlaying = false; #else World.Active.Dispose(); Application.Quit(); #endif }); highscores = Highscores.Load(); }
public void GetScoreList() { entryContainer = transform.Find("highscoreEntryContainer"); foreach (Transform t in entryContainer) { GameObject.Destroy(t.gameObject); } entryTemplate.gameObject.SetActive(false); Highscores.Load(); 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); } }
//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"); // } }
private void Awake() { Highscores.Load(); string scores = Highscores.GetScoresString(); if (string.IsNullOrEmpty(scores)) { scoresText.gameObject.SetActive(false); controlsUI.SetActive(true); } else { controlsUI.SetActive(false); scoresText.gameObject.SetActive(true); scoresText.text = scores; } }
private void Start() { camera = Camera.main; GenerateCollidersAcrossScreen(); Time.timeScale = AITimeScale; if (highscoresUI != null) { // Add function call to wantsToQuit event Application.wantsToQuit += Exiting; hs = new Highscores(); hs.Load(); // Update UI with highscores UpdateHighScoresUI(); } }
public void Init() { score = Program.game.Score; scores = Highscores.Load(); high = scores.TryPut(score); }
public void Init() { table = Highscores.Load(); }