Renders bounding boxes of entities.
        protected override void Initialize()
        {
            ModelDrawer = new InstancedModelDrawer(this);

            ConstraintDrawer = new LineDrawer(this);
            ConstraintDrawer.DisplayTypes.Add(typeof(GrabSpring), typeof(DisplayGrabSpring));
            ConstraintDrawer.DisplayTypes.Add(typeof(MotorizedGrabSpring), typeof(DisplayMotorizedGrabSpring));

            ContactDrawer = new ContactDrawer(this);
            BoundingBoxDrawer = new BoundingBoxDrawer(this);
            SimulationIslandDrawer = new SimulationIslandDrawer(this);

            base.Initialize();
        }
Esempio n. 2
0
        protected override void Initialize()
        {
            //create the ame space
            space = new Space();

            //set the space gravity
            space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);

            //create the player
            player = new Player(this);

            //call UpdateCameraChaseTarget method
            UpdateCameraChaseTarget();

            //call reset camera
            camera.Reset();

            //create the bounding box for the debug view
            debugBoundingBoxDrawer = new BoundingBoxDrawer(this);
            debugDrawer = new BasicEffect(GraphicsDevice);

            //An array to 100 new vector3 move locations
            moveLocations = new Vector3[100];

            //generates a new random number
            Random random = new Random(Guid.NewGuid().GetHashCode());

            //for each movelocation in the array calculates a new random vector3 in the game for the placement of enemies
            for (int i = 0; i < moveLocations.Length; i++)
            {
                float x = random.Next((int)terrainSize) - terrainSize / 2f;
                float y = 15f;
                float z = random.Next((int)terrainSize) - terrainSize / 2f;
                moveLocations[i] = new Vector3(x, y, z);
            }
            base.Initialize();
        }
Esempio n. 3
0
        /// <summary>
        /// Initalize the game
        /// </summary>
        protected override void Initialize()
        {
            debugBoundingBoxDrawer = new BoundingBoxDrawer(this);
            debugDrawer = new BasicEffect(GraphicsDevice);

            space = new Space();
            space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);

            player = new Player(this);
            enemy = new Enemy(this);

            // Set the camera aspect ratio
            // This must be done after the class to base.Initalize() which will
            // initialize the graphics device.
            //camera.AspectRatio = (float)graphics.GraphicsDevice.Viewport.Width /
            //    graphics.GraphicsDevice.Viewport.Height;

            // Perform an inital reset on the camera so that it starts at the resting
            // position. If we don't do this, the camera will start at the origin and
            // race across the world to get behind the chased object.
            // This is performed here because the aspect ratio is needed by Reset.
            UpdateCameraChaseTarget();
            camera.Reset();

            base.Initialize();
        }
Esempio n. 4
0
        protected override void Initialize()
        {
            int height = 600;
            int width = 1000;

            graphics.PreferredBackBufferWidth = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            float maxX = GraphicsDevice.Viewport.Width;
            float maxY = GraphicsDevice.Viewport.Height;
            float xRatio = maxX / 600;
            float yRatio = maxY / 1000;
            average = (xRatio + yRatio) / 2;

            camera = new CameraComponent(this);
            Components.Add(camera);
            Services.AddService(typeof(CameraComponent), camera);

            modelManager = new ModelManager(this);
            Components.Add(modelManager);
            Services.AddService(typeof(ModelManager), modelManager);

            genComponentManager = new GeneralComponentManager(this);
            Components.Add(genComponentManager);
            Services.AddService(typeof(GeneralComponentManager), genComponentManager);

            entities = new EntityManager(this);
            Components.Add(entities);
            Services.AddService(typeof(EntityManager), entities);

            particles = new ParticleManager(this);
            Components.Add(particles);
            Services.AddService(typeof(ParticleManager), particles);

            modelDrawer = new BoundingBoxDrawer(this);

            base.Initialize();
        }