Ejemplo n.º 1
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>("gamefont");

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                area = new Area(content.Load<Texture2D>("pinkArea"),new Vector2(500,500),0f,world);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);

                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 100), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 80), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(120, 100), world));

                int space = 0;

                for (int i = 0; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                Art.Load(content);
                gameFont = content.Load<SpriteFont>("gamefont");

                ParticleManager = new ParticleManager<ParticleState>(1024 * 20, ParticleState.UpdateParticle);
                particleArt = content.Load<Texture2D>("Laser");

                const int maxGridPoints = 1600;
                Vector2 gridSpacing = new Vector2((float)Math.Sqrt(1024 * 768 / maxGridPoints));

                Rectangle posAndSize = new Rectangle(-75, -20, 1140, 640 );
              //  Grid = new Grid(this.ScreenManager.GraphicsDevice.Viewport.Bounds, gridSpacing);
                Grid = new Grid(posAndSize, gridSpacing);

                bloom = new BloomComponent(ScreenManager.Game);
                ScreenManager.Game.Components.Add(bloom);
                area = new Area(content.Load<Texture2D>("pinkArea"),new Vector2(500,500),0f,world);

                cam2D = new Cam2d(ScreenManager.GraphicsDevice);
                reticle = content.Load<Texture2D>("redReticle");
                /// player
                playerBody = new PlayerBody(content.Load<Texture2D>("redPlayer"), world, content);

                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 100), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(100, 80), world));
                Pickupables.Add(new Pickupable(content.Load<Texture2D>("Squares/pinkSquare"), new Vector2(120, 100), world));

                Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(500, 300), world, content, 20));
                Drones.Add(new SeekerDrone(content.Load<Texture2D>("testArrow"), new Vector2(600, 350), world, content, 25));

                Drones[0].Stationary = true;

                int space = 0;

                for (int i = 0; i < 11; i++)
                {
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 0), true, world));
                    Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(space - 5, 600), true, world));

                    if (i <= 5)
                    {
                        //vertical walls
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(-50, space + 50), false, world));
                        Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, space + 50), false, world));
                    }

                    space += 100;
                }

                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 45), false, world));
                Walls.Add(new Wall(content.Load<Texture2D>("Walls/blueWallMedium"), new Vector2(1050, 555), false, world));

                // set cam track

                cam2D.TrackingBody = playerBody.playerBody;
                cam2D.EnableTracking = true;

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

            base.Activate(instancePreserved);
        }