/// <summary> /// Fired when the <see cref="GameUI"/> state changes /// If the new state is <see cref="GameUI.State.GameOver"/> we need to hide the <see cref="TowerUI"/> /// </summary> /// <param name="oldState">The previous state</param> /// <param name="newState">The state to transition to</param> protected void OnGameUIStateChanged(GameUI.State oldState, GameUI.State newState) { if (newState == GameUI.State.GameOver) { Hide(); } }
void OnMessage_UIStateChanged(GameUI.State newState) { if (newState == GameUI.State.SHOPBASE || newState == GameUI.State.SHOPENEMIES || newState == GameUI.State.SHOPPLAYER) { UpdateText(); } }
void OnMessage_UIStateChanged(GameUI.State newState) { Activated = !(newState == GameUI.State.SHOPBASE || newState == GameUI.State.SHOPENEMIES || newState == GameUI.State.SHOPPLAYER); if (Activated) { overlayText.Text = string.Format("Press <color=#ff2255>{0}</color> to open terminal", InputController.Instance.GetInfo("INTERACT").GetInfo()); } }
void OnMessage_UIStateChanged(GameUI.State newState) { if (!enabled) { return; } if (newState == GameUI.State.GAMEOVER || newState == GameUI.State.MENU || newState == GameUI.State.REBINDKEY || newState == GameUI.State.SHOPPLAYER || newState == GameUI.State.SHOPBASE || newState == GameUI.State.SHOPENEMIES) { WantedLockStatus = false; } else { WantedLockStatus = true; } }
/// <summary> /// If the new state is <see cref="GameUI.State.Building"/> then move the ghost to the center of the screen /// </summary> /// <param name="previousState"> /// The previous the GameUI was is in /// </param> /// <param name="currentState"> /// The new state the GameUI is in /// </param> void OnStateChanged(State previousState, State currentState) { // Early return for two reasons // 1. We are not moving into Build Mode // 2. We are not actually touching if (UnityInput.touchCount == 0) { return; } if (currentState == State.Building && previousState != State.BuildingWithDrag) { m_GameUI.MoveGhostToCenter(); confirmationButtons.canvasEnabled = false; invalidButtons.canvasEnabled = false; } if (currentState == State.BuildingWithDrag) { m_IsGhostSelected = true; } }
void OnMessage_UIStateChanged(GameUI.State newState) { InGameUI.Visible = newState == State.GAME; InGameMenu.Visible = newState == State.MENU || newState == State.REBINDKEY; GameOverScreen.Visible = newState == State.GAMEOVER; RebindMenu.Visible = newState == State.REBINDKEY; InGameMenu.Enabled = newState == State.MENU; Shop.Visible = newState == State.SHOPBASE || newState == State.SHOPENEMIES || newState == State.SHOPPLAYER; if (GameOverScreen.Visible) { GameOverTime.Text = timeText.Text; GameOverPoints.Text = pointText.Text; GameOverDeaths.Text = Game.Instance.Deaths.ToString(); } if (InGameMenu.Visible) { MenuTime.Text = timeText.Text; MenuPoints.Text = pointText.Text; MenuDeaths.Text = Game.Instance.Deaths.ToString(); } if (Shop.Visible) { AvaiblePoints.Text = string.Format("Available Points:\n<color=#ff2255>{0}</color>", Game.Instance.Points); Shop_Player.Visible = newState == State.SHOPPLAYER; Shop_Base.Visible = newState == State.SHOPBASE; Shop_Enemies.Visible = newState == State.SHOPENEMIES; Tab_Player.forceHover = newState == State.SHOPPLAYER; Tab_Base.forceHover = newState == State.SHOPBASE; Tab_Enemies.forceHover = newState == State.SHOPENEMIES; lastShopState = newState; } state = newState; }