// Use this for initialization void Start() { WatermelonHealth.resetMelon(); //reset melon health Controller.resetWavesSurvived(); //reset waves survived Controller.setSeeds(START_SEEDS); //reset seed count Cursor.visible = true; }
public Text scoreText; //text displaying player's score // Use this for initialization void Start() { GameObject light = GameObject.FindGameObjectWithTag("Light"); int waves = Controller.getWavesSurvived(); int seeds = Controller.getSeeds(); int health = WatermelonHealth.NUM_MELONS - 1 - WatermelonHealth.getMelonInd(); infoText.text = "Waves Survived: " + waves + " Seeds: " + seeds + " Watermelon Health: " + health; //set text according to number of waves survived scoreText.text = "Score: " + ((WAVES_SCORE_FACTOR * waves) + (SEEDS_SCORE_FACTOR * seeds) + (MELON_HEALTH_SCORE_FACTOR * health)); if (WatermelonHealth.getMelonInd() == WatermelonHealth.NUM_MELONS - 1) { finishMessageText.text = "Game Over"; light.transform.Rotate(new Vector3(30, 0, 0)); } else { finishMessageText.text = "You Win!"; light.transform.Rotate(new Vector3(-40, 0, 0)); } Cursor.visible = true; }
/** * New game button pressed, start a new game */ public void newGame() { WatermelonHealth.resetMelon(); //reset the melon SceneManager.LoadScene("Start"); //go back to the start screen }
private bool isColliding = false; //makes sure ant doesn't collide with watermelon twice // Use this for initialization void Start() { melonScript = GameObject.FindGameObjectWithTag("Finish").GetComponent <WatermelonHealth>(); }