void Update() { RaycastHit seen; Ray raydirection = new Ray(transform.position, transform.forward); if (Physics.Raycast(raydirection, out seen, sightlength)) { if (seen.collider.transform.name.Equals("MenuGame")) { survival.unload(); if (back.load()) { gameManager.resetGame(); SceneManager.LoadScene("GameStart"); } } else if (seen.collider.transform.name.Equals("QuitGame")) { back.unload(); if (survival.load()) { Application.Quit(); } } else { unloadEverything(); } } else { unloadEverything(); } }
void Update() { RaycastHit seen; Ray raydirection = new Ray(transform.position, transform.forward); if (Physics.Raycast(raydirection, out seen, sightlength)) { if (seen.collider.transform.name.Equals("Survival")) { exitgame.unload(); campaign.unload(); tutorial.unload(); highscores.unload(); if (survival.load()) { SceneManager.LoadScene("Game"); } } else if (seen.collider.transform.name.Equals("ExitGame")) { survival.unload(); campaign.unload(); tutorial.unload(); highscores.unload(); if (exitgame.load()) { Application.Quit(); } } else if (seen.collider.transform.name.Equals("HighScores")) { survival.unload(); exitgame.unload(); campaign.unload(); tutorial.unload(); highscores = FindObjectOfType <HighScores>(); if (highscores.load()) { MainMenuObj.SetActive(false); HighScoreObj.SetActive(true); } } else if (seen.collider.transform.name.Equals("Campaign")) { survival.unload(); exitgame.unload(); tutorial.unload(); highscores.unload(); if (campaign.load()) { SceneManager.LoadScene("Game_Level1"); } } else if (seen.collider.transform.name.Equals("Tutorial")) { survival.unload(); exitgame.unload(); campaign.unload(); highscores.unload(); if (tutorial.load()) { SceneManager.LoadScene("Tutorial"); } } else if (seen.collider.transform.name.Equals("Back")) { survival.unload(); exitgame.unload(); campaign.unload(); tutorial.unload(); highscores.unload(); back = FindObjectOfType <GameStart_Back>(); if (back.load()) { back.unload(); MainMenuObj.SetActive(true); HighScoreObj.SetActive(false); } } else { unloadEverything(); } } else { unloadEverything(); } }