Exemple #1
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();
        }
Exemple #2
0
        /// LoadContent will be called once per game and is the place to load all of your content.
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //Assigns the fontToUse variable to the font.
            fontToUse = Content.Load<SpriteFont>(".\\Fonts\\DrWho");
            //Links the player variable to the model which will be controlled by the user/player
            player = new Player("Models\\dalek", Content);

            // Loads all assets for daleks and lasers
            mdlDalek = Content.Load<Model>(".\\Models\\dalek");
            mdDalekTransforms = SetupEffectTransformDefaults(mdlDalek);
            mdlLaser = Content.Load<Model>(".\\Models\\laser");
            mdlLaserTransforms = SetupEffectTransformDefaults(mdlLaser);

            // Loads Audio
            bkgMusic = Content.Load<Song>(".\\Audio\\Bluebell");
            click = Content.Load<SoundEffect>("Audio\\Click");

            //Loads Skybox
            skybox = new Skybox("Skybox/Sunset", Content);

            //load heightMap and heightMapTexture to create landscape
            landscape.SetHeightMapData(Content.Load<Texture2D>("Textures\\HeightMap"), Content.Load<Texture2D>("Textures\\TextureMap"));

            //Loads the background texture for the memu
            backGround = Content.Load<Texture2D>("Textures\\Background");

            // TODO: use this.Content to load your game content here
        }