Beispiel #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //renderEngine = new RenderEngine(this, RenderEngine.Layout.ONE);
            Render.RenderEngine.defaultView = GraphicsDevice.Viewport;
            inputEngine   = new InputEngine(this);
            physicsEngine = new PhysicsEngine(this);
            aiEngine      = new AIEngine(this);

            pickupEngine = new PickUpEngine(this);

            tests[0] = new PickUpGen(this, new Vector3(20, -320, 20), PickUp.PickUpType.AMMO);
            tests[1] = new PickUpGen(this, new Vector3(20, -320, -20), PickUp.PickUpType.HEALTH);
            tests[2] = new PickUpGen(this, new Vector3(-20, -320, 20), PickUp.PickUpType.LEFT);
            tests[3] = new PickUpGen(this, new Vector3(-20, -320, -20), PickUp.PickUpType.RIGHT);

            players = new Player[0];

            /*players = new Player[3];
             * players[0] = new Player(this, PlayerIndex.One, Vector3.Zero);
             * players[1] = new Player(this, PlayerIndex.Two, Vector3.Zero);
             * players[2] = new Player(this, PlayerIndex.Three, new Vector3(100, 0, 0));*/

            //call the super
            base.Initialize();
        }
Beispiel #2
0
        public void WhenRoverPicksComponentsShouldReturnTrue()
        {
            Grid.GridBuilder builder = Grid.Builder();
            Grid             grid    = builder.WithSize(2)
                                       .WithComponentCount(2)
                                       .AddComponent(new Component(new Coordinate(1, 1)))
                                       .AddComponent(new Component(new Coordinate(0, 0)))
                                       .WithRover(new Rover(new Coordinate(1, 0)))
                                       .Build();

            IPickUpEngine pickUpEngine = new PickUpEngine();
            bool          result       = pickUpEngine.PickUpComponents(grid);

            result.Should().Equals(true);
        }
Beispiel #3
0
        public void WhenAValidGridIsInitializedThenRoverShouldPickAllComponentsInCorrectOrder()
        {
            Grid.GridBuilder builder = Grid.Builder();
            Grid             grid    = builder.WithSize(2)
                                       .WithComponentCount(2)
                                       .AddComponent(new Component(new Coordinate(1, 1)))
                                       .AddComponent(new Component(new Coordinate(0, 0)))
                                       .WithRover(new Rover(new Coordinate(1, 0)))
                                       .Build();

            IPickUpEngine pickUpEngine = new PickUpEngine();

            pickUpEngine.PickUpComponents(grid);
            // grid.StartRover();
            for (int i = 0; i < grid.ComponentList.Count; i++)
            {
                grid.ComponentList[i].Coordinate.Should().Equals(grid.Rover.PickupCoordinates[i]);
            }
        }
Beispiel #4
0
        public void WhenRoverPicksMultipleComponentsPathShouldBeCorrect()
        {
            Grid.GridBuilder builder = Grid.Builder();
            Grid             grid    = builder.WithSize(8)
                                       .WithComponentCount(5)
                                       .AddComponent(new Component(new Coordinate(5, 4)))
                                       .AddComponent(new Component(new Coordinate(6, 6)))
                                       .AddComponent(new Component(new Coordinate(1, 0)))
                                       .AddComponent(new Component(new Coordinate(0, 5)))
                                       .AddComponent(new Component(new Coordinate(5, 1)))
                                       .WithRover(new Rover(new Coordinate(4, 6)))
                                       .Build();

            IPickUpEngine pickUpEngine = new PickUpEngine();

            pickUpEngine.PickUpComponents(grid);
            // grid.StartRover();
            grid.Rover.GetPath().Should().Equals("ESSPENNPWSWSWSWSWSPWNNNNNPESESESESEP");
        }