コード例 #1
0
 void Start()
 {
     Timer = SpawnTimer;
     //disables all menus needed not needed at start
     ExitMenu.enabled       = false;
     MainGUI.enabled        = false;
     InGameExitMenu.enabled = false;
     GameOverGUI.enabled    = false;
     DirectionsGUI.enabled  = false;
     //disables all objects not needed at start
     Player.SetActive(false);
     Apple1.SetActive(false);
     Apple2.SetActive(false);
     Apple3.SetActive(false);
     QuitYes.SetActive(false);
     //sets game score to 0
     GameScore = 0;
     // recalls high score info for display at start screen
     HighScore1.text = "HighScore: " + PlayerPrefs.GetString("HighScoreName").ToString() + " - " + ((int)PlayerPrefs.GetFloat("HighScore")).ToString();
 }
コード例 #2
0
 public void StartGame()
 {
     // resets till death count just in case
     TillDeath = 3;
     // calls player high score from previous game to be displayed on player gui
     HighScore.text = "HighScore: " + PlayerPrefs.GetString("HighScoreName").ToString() + " - " + ((int)PlayerPrefs.GetFloat("HighScore")).ToString();
     // start game bool toggle
     GameStart = !GameStart;
     //Makes the start menu go away
     StartGUI.enabled = false;
     MainGUI.enabled  = true;
     //locks the cursor to the game window...or supposed to...havent tested this as i have not tried a build yet.
     Cursor.lockState = CursorLockMode.Confined;
     //hides the cursor so we dont have to look at its ugly self :-)
     Cursor.visible = false;
     // enables the player and his/her/it's lives
     Player.SetActive(true);
     Apple1.SetActive(true);
     Apple2.SetActive(true);
     Apple3.SetActive(true);
 }