예제 #1
0
 protected override void OnLoad(EventArgs e)
 {
     textures = new List <Texture2D>();
     base.OnLoad(e);
     textures.Add(ContentPipe.LoadTexture("T1/bricks.png"));
     textures.Add(ContentPipe.LoadTexture("T1/dark_oak_planks.png"));
     textures.Add(ContentPipe.LoadTexture("T1/dirt.png"));
     textures.Add(ContentPipe.LoadTexture("T1/grass_block_side.png"));
 }
예제 #2
0
        private void InitializeStartGameObjects()
        {
            var artilleryOne = new LightArtillery();
            var artilleryTwo = new LightArtillery();

            var artilleryOneTexture = ContentPipe.LoadTexture("artillery1.jpg");
            var artilleryTwoTexture = ContentPipe.LoadTexture("artillery2.jpg");

            textures.Add(artilleryOne, artilleryOneTexture);
            textures.Add(artilleryTwo, artilleryTwoTexture);

            artilleryOne.Transform.Position = new Vector2(-500.0f, 0);
            artilleryTwo.Transform.Position = new Vector2(500.0f, 0);

            artilleryOne.Components.Add(new BoxCollider(textures[artilleryOne].Width, textures[artilleryOne].Height));
            artilleryTwo.Components.Add(new BoxCollider(textures[artilleryTwo].Width, textures[artilleryTwo].Height));

            gameObjects.Add(artilleryOne);
            gameObjects.Add(artilleryTwo);

            // Walls
            var leftWall   = new Wall(10, this.Height);
            var rightWall  = new Wall(10, this.Height);
            var centerWall = new Wall(100, this.Height);
            var floor      = new Wall(this.Width, this.Height / 4);

            leftWall.Transform.Position   = new Vector2(-this.Width / 2, 0);
            rightWall.Transform.Position  = new Vector2(this.Width / 2, 0);
            centerWall.Transform.Position = new Vector2(0, 0);
            floor.Transform.Position      = new Vector2(0, -this.Height / 4);

            var floorTexture      = ContentPipe.LoadTexture("Floor.jpg");
            var centerWallTexture = ContentPipe.LoadTexture("Center wall.jpg");

            textures.Add(centerWall, centerWallTexture);
            textures.Add(floor, floorTexture);

            gameObjects.Add(leftWall);
            gameObjects.Add(rightWall);
            gameObjects.Add(centerWall);
            gameObjects.Add(floor);
        }