private void Lose() { timerText.color = Color.red; timerText.text = "YOU LOSE!!!"; RectTransform rectXform = timerText.GetComponent <RectTransform>(); rectXform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 450, 160); rectXform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 250, 30); MouseGrab.OnGameWon(); // just to disable mouse function timerText.gameObject.SetActive(false); LoseWindow.SetActive(true); // should be stopped.. MainMusic.Stop(); MainMusic.enabled = false; MainMusic.gameObject.SetActive(false); LoseMusic.Play(); }
private void Win() { timerText.color = Color.green; timerText.text = "YOU WIN!!!"; RectTransform rectXform = timerText.GetComponent <RectTransform>(); rectXform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 450, 160); rectXform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 250, 30); gameOver = true; Vector3 playerPos = Player.transform.position; playerPos.z = distFromPlayer; Camera.main.transform.position = playerPos; Gerbil.HasWon(); // hehe MouseGrab.OnGameWon(); timerText.gameObject.SetActive(false); MainMusic.Stop(); MainMusic.gameObject.SetActive(false); MainMusic.enabled = false; WinWindow.SetActive(true); WinMusic.Play(); }