void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { guiState = Utils.GUIState.OptionsMenu; } }
// Handle move menu selection. Updates tile color when mouse exits hovering over tile. void OnMouseExit() { Utils.GUIState guiState = groundController.TerrainController.BattleController.GUIController.GuiState; if (guiState == Utils.GUIState.MoveMenu || guiState == Utils.GUIState.AttackMenu) { rend.material.color = savedColor; } }
/* * ------------------------------------------------------------------------- * MARK: MENU SERVICE FUNCTIONS * ------------------------------------------------------------------------- */ // Handle action menu GUI. void ActionMenuGUI() { GUI.Box(makeRect(), menuLabelWithUnitName("Action Menu")); if (validMoveMenu && GUI.Button(new Rect(30, 40, 80, 20), "Move")) { guiState = Utils.GUIState.MoveMenu; } if (validAttackMenu && GUI.Button(new Rect(30, 70, 80, 20), "Attack")) { guiState = Utils.GUIState.AttackMenu; } }
// Handle options menu GUI. void OptionsMenuGUI() { GUI.Box(makeRect(), "Options Menu"); if (GUI.Button(new Rect(30, 40, 80, 20), "Save")) { battleController.UnitController.SaveData(); guiState = Utils.GUIState.PartyTurnDefault; } // TESTING ONLY if (GUI.Button(new Rect(30, 70, 80, 20), "Delete")) { DataSaver.deleteData("battleData"); DataSaver.deleteData("unitData"); guiState = Utils.GUIState.PartyTurnDefault; } }
// Checks if tile is in "valid" state in attack menu. bool IsValidAttackSpace() { Utils.GUIState guiState = groundController.TerrainController.BattleController.GUIController.GuiState; return(Utils.CompareColors(rend.material.color, Utils.TileColor.OccupiedByEnemy) && guiState == Utils.GUIState.AttackMenu); }
/* * ------------------------------------------------------------------------- * MARK: HELPER FUNCTIONS * ------------------------------------------------------------------------- */ // Checks if tile is in "valid" state in move menu. bool IsValidMoveSpace() { Utils.GUIState guiState = groundController.TerrainController.BattleController.GUIController.GuiState; return(Utils.CompareColors(rend.material.color, Utils.TileColor.Valid) && guiState == Utils.GUIState.MoveMenu); }