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(); }
void Start() { Apple3 myApple = new Apple3(); //Notice that the Apple version of the methods //override the fruit versions. Also notice that //since the Apple versions call the Fruit version with //the "base" keyword, both are called. myApple.SayHello(); myApple.Chop(); //Overriding is also useful in a polymorphic situation. //Since the methods of the Fruit class are "virtual" and //the methods of the Apple class are "override", when we //upcast an Apple into a Fruit, the Apple version of the //Methods are used. Fruit3 myFruit = new Apple3(); myFruit.SayHello(); myFruit.Chop(); }
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); }