Exemple #1
0
 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);
        }
Exemple #3
0
        public StartScreen()
        {
            input = new InputManager();
            for (int i = 0; i < 11; i++)
            {
                int j = i + 1;
                title[i] = "sstitle" + j.ToString();
            }
            start[0] = "ssstart";
            start[1] = "ssstartw";

            MediaPlayer.IsRepeating = true;
        }
        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);
        }
 public SpaceshipController(Spaceship spaceship, InputManager input)
 {
     this.spaceship = spaceship;
     this.input = input;
 }
Exemple #6
0
 public MenuScreen()
 {
     input = new InputManager();
     names[0] = "menu";
     names[1] = "intructions";
 }