/// <summary> /// Handles input during the discovery phase of the game. /// </summary> /// <remarks> /// Escape opens the game menu. Clicking the mouse will /// attack a location. /// </remarks> public static void HandleDiscoveryInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } else if (SwinGame.MouseClicked(MouseButton.LeftButton) & UtilityFunctions.IsMouseInRectangle(MENU_LEFT, MENU_TOP, MENU_WIDTH, MENU_WIDTH)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { DoAttack(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { if (UtilityFunctions.IsMouseInRectangle(MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP, MUTE_BUTTON_WIDTH, MUTW_BUTTON_HEIGHT) && (Sound == true)) { SwinGame.StopMusic(); SwinGame.DrawText("AUDIO OFF", Color.White, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); Sound = false; } else if (UtilityFunctions.IsMouseInRectangle(MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP, MUTE_BUTTON_WIDTH, MUTW_BUTTON_HEIGHT) && (Sound == false)) { SwinGame.PlayMusic(GameResources.GameMusic("Background")); SwinGame.DrawText("AUDIO ON", Color.Grey, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); Sound = true; } } }
// '' <summary> // '' Starts a new game. // '' </summary> // '' <remarks> // '' Creates an AI player based upon the _aiSetting. // '' </remarks> public static void StartGame() { if (_theGame != null) { GameController.EndGame(); } // Create the game _theGame = new BattleShipsGame(); // create the players switch (_aiSetting) { case AIOption.Medium: _ai = new AIMediumPlayer(_theGame); break; case AIOption.Hard: _ai = new AIHardPlayer(_theGame); break; default: _ai = new AIEasyPlayer(_theGame); break; } _human = new Player(_theGame); // AddHandler _human.PlayerGrid.Changed, AddressOf GridChanged _ai.PlayerGrid.Changed += GridChanged; _theGame.AttackCompleted += AttackCompleted; GameController.AddNewState(GameState.Deploying); }
/// <summary> /// The main menu was clicked, perform the button's action. /// </summary> /// <param name="button">the button pressed</param> private static void PerformMainMenuAction(int button) { switch (button) { case MAIN_MENU_PLAY_BUTTON: GameController.StartGame(); break; case MAIN_MENU_SETUP_BUTTON: GameController.AddNewState(GameState.AlteringSettings); break; case MAIN_MENU_TOP_SCORES_BUTTON: GameController.AddNewState(GameState.ViewingHighScores); break; case MAIN_MENU_HELP_BUTTON: GameController.AddNewState(GameState.Help); break; case MAIN_MENU_FULLSCREEN_BUTTON: SwinGame.ToggleFullScreen(); break; case MAIN_MENU_AUDIO_BUTTON: GameController.SwitchAudio(); break; case MAIN_MENU_QUIT_BUTTON: GameController.EndCurrentState(); break; } }
/// <summary> /// ''' The main menu was clicked, perform the button's action. /// ''' </summary> /// ''' <param name="button">the button pressed</param> private static void PerformMainMenuAction(int button) { switch (button) { case MAIN_MENU_PLAY_BUTTON: { GameController.StartGame(); break; } case MAIN_MENU_SETUP_BUTTON: { GameController.AddNewState(GameState.AlteringSettings); break; } case MAIN_MENU_TOP_SCORES_BUTTON: { GameController.AddNewState(GameState.ViewingHighScores); break; } case MAIN_MENU_QUIT_BUTTON: { GameController.EndCurrentState(); break; } } }
// If the game menu was clicked, perform the button's action private static void PerformGameMenuAction(int button) { // CHECK Implement Case Statement switch (button) { case GAME_MENU_RETURN_BUTTON: GameController.EndCurrentState(); break; case GAME_MENU_SURRENDER_BUTTON: GameController.EndCurrentState(); GameController.EndCurrentState(); break; case GAME_MENU_QUIT_BUTTON: GameController.AddNewState(GameState.Quitting); break; case GAME_MENU_MUTE_BUTTON: Audio.PauseMusic(); break; case GAME_MENU_UNMUTE_BUTTON: Audio.ResumeMusic(); break; case GAME_MENU_RESET_BUTTON: GameController.AddNewState(GameState.ReDiscovering); break; } }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP) | SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT) | SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } if (GameController.HumanPlayer.ReadyToDeploy & UtilityFunctions.IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } else if (UtilityFunctions.IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(MENU_BUTTON_LEFT, MENU_BUTTON_TOP, MENU_BUTTON_WIDTH, MENU_BUTTON_HEIGHT)) { GameController.EndCurrentState(); } } }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.EscapeKey)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.UpKey) | SwinGame.KeyTyped(KeyCode.DownKey)) { _currentDirection = Direction.UpDown; } if (SwinGame.KeyTyped(KeyCode.LeftKey) | SwinGame.KeyTyped(KeyCode.RightKey)) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.RKey)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected; selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } else { DoDeployClick(); } // ** BUG ** // ** Both buttons do the same thing. ** if (GameController.HumanPlayer.ReadyToDeploy & UtilityFunctions.IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } else if (UtilityFunctions.IsMouseInRectangle(LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } } }
private static void PerformQuitMenuAction(int button) { if (button == QUIT_MENU_YES) { GameController.AddNewState(GameState.Quitting); } else { GameController.EndCurrentState(); } }
// '' <summary> // '' Handles user input for the Deployment phase of the game. // '' </summary> // '' <remarks> // '' Involves selecting the ships, deloying ships, changing the direction // '' of the ships to add, randomising deployment, end then ending // '' deployment // '' </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.EscapeKey)) { GameController.AddNewState(GameState.ViewingGameMenu); } if ((SwinGame.KeyTyped(KeyCode.UpKey) || SwinGame.KeyTyped(KeyCode.DownKey))) { _currentDirection = Direction.UpDown; } if ((SwinGame.KeyTyped(KeyCode.LeftKey) || SwinGame.KeyTyped(KeyCode.RightKey))) { _currentDirection = Direction.LeftRight; } if (SwinGame.KeyTyped(KeyCode.RKey)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected; selected = DeploymentController.GetShipMouseIsOver(); if ((selected != ShipName.None)) { _selectedShip = selected; } else { DeploymentController.DoDeployClick(); } if ((GameController.HumanPlayer.ReadyToDeploy && SwinGame.PointInRect(SwinGame.MousePosition(), PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT))) { GameController.EndDeployment(); } else if (SwinGame.PointInRect(SwinGame.MousePosition(), UP_DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.UpDown; } else if (SwinGame.PointInRect(SwinGame.MousePosition(), LEFT_RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.LeftRight; } else if (SwinGame.PointInRect(SwinGame.MousePosition(), RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } } }
/// <summary> /// Handles input during the discovery phase of the game. /// </summary> /// <remarks> /// Escape opens the game menu. Clicking the mouse will /// attack a location. /// </remarks> public static void HandleDiscoveryInput() { if (SwinGame.KeyTyped(KeyCode.vk_a)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { DoAttack(); } }
// Starts a new game, and creates an AI player based upon // the _aiSetting currently set public static void StartGame() { if (!(_theGame == null)) { GameController.EndGame(); } // Create the game _theGame = new BattleShipsGame(); if (_playableShips.Count == 0) { foreach (ShipName name in Enum.GetValues(typeof(ShipName))) { if (name != ShipName.None) { _playableShips.Add(name); } } } // create the players switch (_aiSetting) { case AIOption.Easy: _ai = new AIEasyPlayer(_theGame, _playableShips); Audio.PlaySoundEffect(GameResources.GameSound("Easy")); break; case AIOption.Medium: _ai = new AIMediumPlayer(_theGame, _playableShips); Audio.PlaySoundEffect(GameResources.GameSound("Medium")); break; case AIOption.Hard: _ai = new AIHardPlayer(_theGame, _playableShips); Audio.PlaySoundEffect(GameResources.GameSound("Hard")); break; default: _ai = new AIMediumPlayer(_theGame, _playableShips); Audio.PlaySoundEffect(GameResources.GameSound("Medium")); break; } _human = new Player(_theGame, _playableShips); // AddHandler _human.PlayerGrid.Changed, AddressOf GridChanged _ai.PlayerGrid.Changed += GridChanged; _theGame.AttackCompleted += AttackCompleted; GameController.AddNewState(GameState.Deploying); // Stops listening to the old game once a new game has been started }
/// <summary> /// Read the user's name for their highsSwinGame. /// </summary> /// <param name="value">the player's sSwinGame.</param> /// <remarks> /// This verifies if the score is a highsSwinGame. /// </remarks> public static void ReadHighScore(int value) { const int ENTRY_TOP = 500; if (_Scores.Count == 0) { LoadScores(); } //is it a high score if (value > _Scores[_Scores.Count - 1].Value) { Score s = new Score(); s.Value = value; GameController.AddNewState(GameState.ViewingHighScores); int x = 0; x = SCORES_LEFT + SwinGame.TextWidth(GameResources.GameFont("Courier"), "Name: "); //this is the line for reading in the users inputted name SwinGame.StartReadingText(Color.Yellow, NAME_WIDTH, GameResources.GameFont("Courier"), x, ENTRY_TOP); //Read the text from the user while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); UtilityFunctions.DrawBackground(); DrawHighScores(); SwinGame.DrawText("Name: ", Color.White, GameResources.GameFont("Courier"), SCORES_LEFT, ENTRY_TOP); SwinGame.RefreshScreen(); } s.Name = SwinGame.TextReadAsASCII(); if (s.Name.Length < 10) { s.Name = s.Name + new string(Convert.ToChar(" "), 10 - s.Name.Length); } _Scores.RemoveAt(_Scores.Count - 1); _Scores.Add(s); _Scores.Sort(); GameController.EndCurrentState(); } }
/// <summary> /// Handles input during the discovery phase of the game. /// </summary> /// <remarks> /// Escape opens the game menu. Clicking the mouse will /// attack a location. /// </remarks> public static void HandleDiscoveryInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { if (UtilityFunctions.IsMouseInRectangle(MENU_BUTTON_LEFT, MENU_BUTTON_TOP, MENU_BUTTON_WIDTH, MENU_BUTTON_WIDTH)) { GameController.EndCurrentState(); } DoAttack(); } }
/// <summary> /// The game menu was clicked, perform the button's action. /// </summary> /// <param name="button">the button pressed</param> private static void PerformGameMenuAction(int button) { switch (button) { case GAME_MENU_RETURN_BUTTON: GameController.EndCurrentState(); break; case GAME_MENU_SURRENDER_BUTTON: GameController.EndCurrentState(); //end game menu GameController.EndCurrentState(); //end game break; case GAME_MENU_QUIT_BUTTON: GameController.AddNewState(GameState.Quitting); break; } }
// Handles the user input during the discovery phase. // Escape opens the game menu. Clicking the mouse will launch // an attack at that location. public static void HandleDiscoveryInput() { if (GameController.CurrentState == GameState.ReDiscovering) { GameController.HumanPlayer.Reset(); GameController.EndCurrentState(); GameController.EndCurrentState(); } if (SwinGame.KeyTyped(KeyCode.EscapeKey)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { DoAttack(); } }
private static void PerformGameMenuAction(int button) { // CHECK Implement Case Statement switch (button) { case GAME_MENU_RETURN_BUTTON: GameController.EndCurrentState(); break; case GAME_MENU_SURRENDER_BUTTON: GameController.EndCurrentState(); GameController.EndCurrentState(); break; case GAME_MENU_QUIT_BUTTON: GameController.AddNewState(GameState.QuitConfirm); break; } }
// '' <summary> // '' Read the user's name for their highsSwinGame. // '' </summary> // '' <param name="value">the player's sSwinGame.</param> // '' <remarks> // '' This verifies if the score is a highsSwinGame. // '' </remarks> public static void ReadHighScore(int value) { const int ENTRY_TOP = 550; if ((_Scores.Count == 0)) { HighScoreController.LoadScores(); } // is it a high score if ((value > _Scores[(_Scores.Count - 1)].Value)) { Score s = new Score(); s.Value = value; GameController.AddNewState(GameState.ViewingHighScores); int x; x = (SCORES_LEFT + SwinGame.TextWidth(GameResources.GameFont("Courier"), "Name: ")); SwinGame.StartReadingText(Color.Black, NAME_WIDTH, GameResources.GameFont("Courier"), x, ENTRY_TOP); // Read the text from the user while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); UtilityFunctions.DrawBackground(); HighScoreController.DrawHighScores(); SwinGame.DrawText("Name: ", Color.Black, GameResources.GameFont("Courier"), SCORES_LEFT, ENTRY_TOP); SwinGame.RefreshScreen(); } s.Name = SwinGame.TextReadAsASCII(); if ((s.Name.Length < 3)) { s.Name = (s.Name + new string(((char)(' ')), (3 - s.Name.Length))); } _Scores.RemoveAt((_Scores.Count - 1)); _Scores.Add(s); _Scores.Sort(); SaveScores(); GameController.EndCurrentState(); } }
// Reads the users name for their high score public static void ReadHighScore(int value) { const int ENTRY_TOP = 500; if (_Scores.Count == 0) { LoadScores(); } if (value > _Scores[_Scores.Count - 1].Value) { Score s = new Score(); s.Value = value; GameController.AddNewState(GameState.ViewingHighScores); int x; x = SCORES_LEFT + SwinGame.TextWidth(SwinGame.FontNamed("Courier"), "Name: "); SwinGame.StartReadingText(Color.White, NAME_WIDTH, GameResources.GameFont("Courier"), x, ENTRY_TOP); while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); UtilityFunctions.DrawBackground(); DrawHighScores(); SwinGame.DrawText("Name: ", Color.White, GameResources.GameFont("Courier"), SCORES_LEFT, ENTRY_TOP); SwinGame.RefreshScreen(); } s.Name = SwinGame.TextReadAsASCII(); if (s.Name.Length < 3) { s.Name = s.Name + new string(Convert.ToChar(" "), 3 - s.Name.Length); } _Scores.RemoveAt(_Scores.Count - 1); _Scores.Add(s); _Scores.Sort(); SaveScores(); GameController.EndCurrentState(); } }
private static void PerformMainMenuAction(int button) { // CHECK Implement Case Statement switch (button) { case MAIN_MENU_PLAY_BUTTON: GameController.StartGame(); break; case MAIN_MENU_SETUP_BUTTON: GameController.AddNewState(GameState.AlteringSettings); break; case MAIN_MENU_TOP_SCORES_BUTTON: GameController.AddNewState(GameState.ViewingHighScores); break; case MAIN_MENU_QUIT_BUTTON: GameController.AddNewState(GameState.Quitting);; break; } }
// '' <summary> // '' Starts a new game. // '' </summary> // '' <remarks> // '' Creates an AI player based upon the _aiSetting. // '' </remarks> public static void StartGame() { if (!(_theGame == null)) { GameController.EndGame(); } // Create the game _theGame = new BattleShipsGame(); // create the players switch (_aiSetting) { case AIOption.Easy: _ai = new AIHardPlayer(_theGame); break; case AIOption.Medium: _ai = new AIMediumPlayer(_theGame); break; case AIOption.Hard: _ai = new AIHardPlayer(_theGame); break; default: _ai = new AIMediumPlayer(_theGame); break; } _human = new Player(_theGame); // AddHandler _human.PlayerGrid.Changed, AddressOf GridChanged _ai.PlayerGrid.Changed += GridChanged; _theGame.AttackCompleted += AttackCompleted; GameController.AddNewState(GameState.Deploying); // '' <summary> // '' Stops listening to the old game once a new game is started // '' </summary> }
// If the main menu was clicked, perform the button's action private static void PerformMainMenuAction(int button) { // CHECK Implement Case Statement switch (button) { case MAIN_MENU_PLAY_BUTTON: GameController.StartGame(); break; case MAIN_MENU_SETUP_BUTTON: GameController.AddNewState(GameState.AlteringSettings); break; case MAIN_MENU_TOP_SCORES_BUTTON: GameController.AddNewState(GameState.ViewingHighScores); break; case MAIN_MENU_QUIT_BUTTON: GameController.AddNewState(GameState.Quitting);; break; case MAIN_MENU_SHIPS_BUTTON: GameController.AddNewState(GameState.AlteringShipSettings); break; case MAIN_MENU_MUTE_BUTTON: Audio.PauseMusic(); break; case MAIN_MENU_UNMUTE_BUTTON: Audio.ResumeMusic(); break; case MAIN_MENU_THEME_BUTTON: GameController.AddNewState(GameState.ChangingThemes); break; } }
// '' <summary> // '' End the current state and add in the new state. // '' </summary> // '' <param name="newState">the new state of the game</param> public static void SwitchState(GameState newState) { GameController.EndCurrentState(); GameController.AddNewState(newState); }
/// <summary> /// Handles user input for the Deployment phase of the game. /// </summary> /// <remarks> /// Involves selecting the ships, deloying ships, changing the direction /// of the ships to add, randomising deployment, end then ending /// deployment /// </remarks> public static void HandleDeploymentInput() { if (SwinGame.KeyTyped(KeyCode.vk_ESCAPE)) { GameController.AddNewState(GameState.ViewingGameMenu); } else if (SwinGame.MouseClicked(MouseButton.LeftButton) & UtilityFunctions.IsMouseInRectangle(MENU_LEFT, MENU_TOP, MENU_WIDTH, MENU_WIDTH)) { GameController.AddNewState(GameState.ViewingGameMenu); } if (SwinGame.KeyTyped(KeyCode.vk_UP)) { _currentDirection = Direction.Up; } if (SwinGame.KeyTyped(KeyCode.vk_DOWN)) { _currentDirection = Direction.Down; } if (SwinGame.KeyTyped(KeyCode.vk_LEFT)) { _currentDirection = Direction.Left; } if (SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { _currentDirection = Direction.Right; } if (SwinGame.KeyTyped(KeyCode.vk_r)) { GameController.HumanPlayer.RandomizeDeployment(); } if (SwinGame.MouseClicked(MouseButton.LeftButton)) { ShipName selected = default(ShipName); selected = GetShipMouseIsOver(); if (selected != ShipName.None) { _selectedShip = selected; } if (GameController.HumanPlayer.ReadyToDeploy && UtilityFunctions.IsMouseInRectangle(PLAY_BUTTON_LEFT, TOP_BUTTONS_TOP, PLAY_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.EndDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(UP_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.Up; DoUpClick(); } else if (UtilityFunctions.IsMouseInRectangle(DOWN_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.Down; DoDownClick(); } else if (UtilityFunctions.IsMouseInRectangle(LEFT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.Left; DoLeftClick(); } else if (UtilityFunctions.IsMouseInRectangle(RIGHT_BUTTON_LEFT, TOP_BUTTONS_TOP, DIR_BUTTONS_WIDTH, TOP_BUTTONS_HEIGHT)) { _currentDirection = Direction.Right; DoRightClick(); } else if (UtilityFunctions.IsMouseInRectangle(RANDOM_BUTTON_LEFT, TOP_BUTTONS_TOP, RANDOM_BUTTON_WIDTH, TOP_BUTTONS_HEIGHT)) { GameController.HumanPlayer.RandomizeDeployment(); } else if (UtilityFunctions.IsMouseInRectangle(MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP, MUTE_BUTTON_WIDTH, MUTW_BUTTON_HEIGHT) && (Sound == true)) { SwinGame.StopMusic(); SwinGame.DrawText("AUDIO ON", Color.Grey, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); Sound = false; } else if (UtilityFunctions.IsMouseInRectangle(MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP, MUTE_BUTTON_WIDTH, MUTW_BUTTON_HEIGHT) && (Sound == false)) { SwinGame.PlayMusic(GameResources.GameMusic("Background")); SwinGame.DrawText("AUDIO OFF", Color.White, MUTE_BUTTON_LEFT, MUTE_BUTTON_TOP); Sound = true; } else { DoDeployClick(); } } }