//Listens to input from mouse and keyboard and carries out appropriate actions public void KeyboardListener(KeyboardState CurrentKeyboardState, KeyboardState LastKeyboardState, MouseState CurrentMouseState, MouseState LastMouseState) { //Creates an instance of a building at the position of the mouse when B is held down and left mouse button clicked if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) && (CurrentKeyboardState.IsKeyDown(Keys.T))) { BaseBuilding newBuilding; newBuilding = new Tower(); newBuilding.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y)); mBuildings.Add(newBuilding); } if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) && (CurrentKeyboardState.IsKeyDown(Keys.W))) { BaseBuilding newBuilding; newBuilding = new Wall(); newBuilding.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y)); mBuildings.Add(newBuilding); } if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) && (CurrentKeyboardState.IsKeyDown(Keys.F))) { BaseBuilding newBuilding; newBuilding = new Factory(); newBuilding.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y)); mBuildings.Add(newBuilding); } }