From 112a91b7084a5365291c712fabcb8ceeb4c644ce Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Sun, 8 Oct 2017 22:43:20 +0200 Subject: Added game over screen --- td/Assets/Scripts/mainGUI.cs | 111 +++++++++++++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 30 deletions(-) (limited to 'td/Assets/Scripts/mainGUI.cs') diff --git a/td/Assets/Scripts/mainGUI.cs b/td/Assets/Scripts/mainGUI.cs index 1c18a17..35d3948 100644 --- a/td/Assets/Scripts/mainGUI.cs +++ b/td/Assets/Scripts/mainGUI.cs @@ -1,33 +1,37 @@ using System; -using System.Collections; -using System.Collections.Generic; using UnityEngine.UI; using UnityEngine; public class MainGui : MonoBehaviour { - - GameObject _pnlMenu; - GameObject _pnlSidebar; - GameObject _pnlSettings; - RectTransform _pnlSidebarTransform; - Button _btnToggleSidebar; - Button _btnPauseGame; - Button _btnResumeGame; - Button _btnExitGame; - Button _btnSettings; - Button _btnSettingsDiscard; - Button _btnSettingsSave; - - bool _sidebarExpanded; - float[] _sidebarStates = new float[2] {0f, -202.4f}; // The x position of the sidebar expanded or collapsed - - bool _menuActive; - - void Awake() { + private GameObject _pnlMenu; + private GameObject _pnlSidebar; + private GameObject _pnlSettings; + private GameObject _pnlGameOver; + private RectTransform _pnlSidebarTransform; + private Button _btnToggleSidebar; + private Button _btnPauseGame; + private Button _btnResumeGame; + private Button _btnExitGame; + private Button _btnSettings; + private Button _btnSettingsDiscard; + private Button _btnSettingsSave; + private Button _btnGoRetry; + private Button _btnGoMenu; + private Text _txtGoScore; + private Text _txtGoHighScore; + private Text _txtGoNewHighScore; + + private bool _sidebarExpanded; + private readonly float[] _sidebarStates = new float[2] {0f, -202.4f}; // The x position of the sidebar expanded or collapsed + + private bool _menuActive; + + private void Awake() { /* Panels */ _pnlMenu = transform.Find ("menu").gameObject; _pnlSidebar = transform.Find ("sidebarWrapper").gameObject; _pnlSettings = transform.Find ("settings").gameObject; + _pnlGameOver = transform.Find("GameOver").gameObject; _pnlSidebarTransform = _pnlSidebar.GetComponent (); /* Buttons */ @@ -38,6 +42,8 @@ public class MainGui : MonoBehaviour { _btnSettings = _pnlMenu.transform.Find ("settings").gameObject.GetComponent