public GameScreen() { background = new Background(); Spaceship spaceship = new Spaceship(); input = new InputManager(); controller = new SpaceshipController(spaceship, input); random = new Random(); gameObjectsManager = new GameObjectsManager(spaceship, random); hud = new GameInfo(); gameObjectsManager.AddStartingCows(); }
public void ProcessSpaceInputTest() { Spaceship spaceship = new Spaceship(); InputManager input = new InputManager(); PrivateObject privateInput = new PrivateObject(input); privateInput.SetField("currentState", new KeyboardState(Keys.Space)); SpaceshipController controller = new SpaceshipController(spaceship, input); controller.ProcessInput(); Assert.IsTrue(spaceship.BeamOn); }
public void UpInputTest() { Spaceship spaceship = new Spaceship(); InputManager input = new InputManager(); PrivateObject privateInput = new PrivateObject(input); privateInput.SetField("currentState", new KeyboardState(Keys.W)); SpaceshipController controller = new SpaceshipController(spaceship, input); spaceship.Y = 300; controller.ProcessInput(); Assert.AreEqual(300 - spaceship.Speed, spaceship.Y); }