//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 units at the position of the mouse when V is held down and left mouse button clicked if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) && (CurrentKeyboardState.IsKeyDown(Keys.V))) { BaseUnit newUnit; newUnit = new Velociraptor(); newUnit.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y)); mUnits.Add(newUnit); } if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) && (CurrentKeyboardState.IsKeyDown(Keys.B))) { BaseUnit newUnit; newUnit = new BearCavalry(); newUnit.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y)); mUnits.Add(newUnit); } if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) && (CurrentKeyboardState.IsKeyDown(Keys.T))) { BaseUnit newUnit; newUnit = new Tank(); newUnit.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y)); mUnits.Add(newUnit); } }