Exemplo n.º 1
0
        public override void LoadContent()
        {
            _cameraMatrix = Matrix.Identity;
            _projectionMatrix = Matrix.CreateOrthographicOffCenter(0, ScreenManager.ScreenWidth, ScreenManager.ScreenHeight, 0, -100, 100);
            _worldMatrix = Matrix.Identity;

            _waterModel = new WaterModel();
            _waterModel.Initialize(PhysicsSimulator, new Vector2(ScreenManager.ScreenHeight * .05f, 500), new Vector2(ScreenManager.ScreenWidth - ((ScreenManager.ScreenHeight * .05f) * 2.0f), ScreenManager.ScreenHeight - 500));
            _waterModel.WaveController.Enabled = true;  // if false waves will not be created

            _platform = new Box(300, 20, new Vector2(ScreenManager.ScreenWidth / 2f, 500));
            _platform.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            _refTexture = DrawingHelper.CreateRectangleTexture(ScreenManager.GraphicsDevice, 32, 32, 2, 0, 0,
                                                               Color.White, Color.Black);

            _refBody = BodyFactory.Instance.CreateRectangleBody(32, 32, 3f);
            _refGeom = GeomFactory.Instance.CreateRectangleGeom(_refBody, 32, 32);
            _refGeom.FrictionCoefficient = .2f;

            //create the _pyramid near the bottom of the screen.
            _pyramid = new Pyramid(_refBody, _refGeom, 32f / 3f, 32f / 3f, 32, 32, _pyramidBaseBodyCount,
                                   new Vector2(ScreenManager.ScreenCenter.X - _pyramidBaseBodyCount * .5f * (32 + 32 / 3) + 20,
                                               ScreenManager.ScreenHeight - 300));

            _pyramid.Load(PhysicsSimulator);

            //Add the geometries to the watermodel's fluiddragcontroller to make them float.
            _waterModel.FluidDragController.AddGeom(_platform.Geom);

            foreach (Geom geom in _pyramid.Geoms)
            {
                _waterModel.FluidDragController.AddGeom(geom);
            }

            // load a font
            _font = ScreenManager.ContentManager.Load<SpriteFont>("Content/Fonts/detailsfont");

            base.LoadContent();
        }
Exemplo n.º 2
0
        public override void LoadContent()
        {
            //We load the grenade texture here instead of inside Grenade class. Load once, use multiple times.
            _grenadeTexture = ScreenManager.ContentManager.Load<Texture2D>("Content/Grenade");

            _rectangleTexture = DrawingHelper.CreateRectangleTexture(ScreenManager.GraphicsDevice, 32, 32, 2, 0, 0,
                                                                     Color.White, Color.Black);

            _rectangleBody = BodyFactory.Instance.CreateRectangleBody(32, 32, 1f);
            _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(_rectangleBody, 32, 32);
            _rectangleGeom.FrictionCoefficient = .4f;
            _rectangleGeom.RestitutionCoefficient = 0.0f;

            _pyramid = new Pyramid(_rectangleBody, _rectangleGeom, 32f / 5f, 32f / 5f, 32, 32, pyramidBaseBodyCount,
                                   new Vector2(ScreenManager.ScreenCenter.X - pyramidBaseBodyCount * .5f * (32 + 32 / 3),
                                               ScreenManager.ScreenHeight - 125));

            _pyramid.Load(PhysicsSimulator);

            _hairDryer = new HairDryer(new Vector2(100, 100), PhysicsSimulator);
            _hairDryer.Load(ScreenManager.ContentManager.Load<Texture2D>("Content/HairDryer"));

            base.LoadContent();
        }
Exemplo n.º 3
0
        public override void LoadContent()
        {
            _rectangleTexture = DrawingHelper.CreateRectangleTexture(ScreenManager.GraphicsDevice, 32, 32, 2, 0, 0,
                                                                     Color.White, Color.Black);

            _rectangleBody = BodyFactory.Instance.CreateRectangleBody(32, 32, 1f); //template
            _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(_rectangleBody, 32, 32); //template
            _rectangleGeom.FrictionCoefficient = .4f;
            _rectangleGeom.RestitutionCoefficient = 0f;

            //create the pyramid near the bottom of the screen.
            _pyramid = new Pyramid(_rectangleBody, _rectangleGeom, 32f / 3f, 32f / 3f, 32, 32, _pyramidBaseBodyCount,
                                   new Vector2(ScreenManager.ScreenCenter.X - _pyramidBaseBodyCount * .5f * (32 + 32 / 3),
                                               ScreenManager.ScreenHeight - 60));

            _pyramid.Load(PhysicsSimulator);

            _agent = new Agent(ScreenManager.ScreenCenter - new Vector2(320, 200));
            _agent.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            base.LoadContent();
        }