Beispiel #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.SupportedOrientations = DisplayOrientation.Portrait;
            Content.RootDirectory          = "Content";
            camera         = new ChaseCamera(heightMap);
            IsMouseVisible = true;
            // Set the camera offsets
            camera.DesiredPositionOffset = new Vector3(0.0f, 100.0f, 200.0f);
            camera.LookAtOffset          = new Vector3(0f, 15.0f, 30.0f);

            camera.NearPlaneDistance = 10.0f;
            camera.FarPlaneDistance  = 100000.0f;
        }
Beispiel #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.SupportedOrientations = DisplayOrientation.Portrait;
            Content.RootDirectory = "Content";
            camera = new ChaseCamera(heightMap);
            IsMouseVisible = true;
            // Set the camera offsets
            camera.DesiredPositionOffset = new Vector3(0.0f, 100.0f, 200.0f);
            camera.LookAtOffset = new Vector3(0f, 15.0f, 30.0f);

            camera.NearPlaneDistance = 10.0f;
            camera.FarPlaneDistance = 100000.0f;
        }
Beispiel #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        override public void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(device);
            spriteFont  = content.Load <SpriteFont>("Arial");

            camera = new ChaseCamera(heightMap);
            // Set the camera offsets
            camera.DesiredPositionOffset = new Vector3(0.0f, 100.0f, 200.0f);
            camera.LookAtOffset          = new Vector3(0f, 15.0f, 30.0f);

            ball       = new Ball(this, device, "Models\\balltest");
            ball.scale = Vector3.One * 15f;

            camera.NearPlaneDistance = 10.0f;
            camera.FarPlaneDistance  = 100000.0f;
            camera.AspectRatio       = (float)device.Viewport.Width /
                                       device.Viewport.Height;
            camera.ChasePosition  = ball.position;
            camera.ChaseDirection = ball.Direction;
            camera.Up             = ball.Up;
            camera.Reset();

            ballModel  = content.Load <Model>("Models\\balltest");
            pitModel   = content.Load <Model>("Models\\ground");
            boxModel   = content.Load <Model>("Models\\cube");
            arrowModel = content.Load <Model>("Models\\arrow");
            exitModel  = content.Load <Model>("Models\\exit2");
            //exitModelText = content.Load<Model>("Models\\exitSign");
            ballTextureBeach  = content.Load <Texture2D>("Textures\\beach");
            ballTextureMetal  = content.Load <Texture2D>("Textures\\metal");
            ballTextureAir    = content.Load <Texture2D>("Textures\\air");
            coinTexture       = content.Load <Texture2D>("Textures\\coin");
            teleporterTexture = content.Load <Texture2D>("Textures\\teleporter");
            terrainModel      = content.Load <Model>(terrain);
            rockTexture       = content.Load <Texture2D>(terrainTexture);
            pitTextureLava    = content.Load <Texture2D>("Textures\\lava");
            pitTextureIce     = content.Load <Texture2D>("Textures\\3");
            scoreboardTexture = content.Load <Texture2D>("Textures\\highscores");
            heightMap         = terrainModel.Tag as HeightMapInfo;
            if (heightMap == null)
            {
                string message = "The terrain model did not have a HeightMapInfo";
                throw new InvalidOperationException(message);
            }
            Sound.playSoundLoop(background, content);
            effect = content.Load <Effect>("Lighting/Effects");
            sky    = content.Load <Sky>("Textures\\sky");

            /*Initialize properties for each ball*/
            beachBallProperties   = new BallProperties(ballTextureBeach, 1.0f, 0.5f, 900f, 1f, new Vector3(0.97f, 1f, 0.97f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall");
            metalBallProperties   = new BallProperties(ballTextureMetal, 3.0f, 0.15f, 750f, 3f, new Vector3(0.95f, 1f, 0.95f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall");
            airBallProperties     = new BallProperties(ballTextureAir, 1f, 0.05f, 1200f, 0.8f, new Vector3(0.99f, 0.99f, 0.99f), new Vector3(0.99f, 0.99f, 0.99f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall");
            currentBallProperties = beachBallProperties;

            List <Texture2D> textures = new List <Texture2D>();

            textures.Add(Content.Load <Texture2D>("Textures\\circle"));
            textures.Add(Content.Load <Texture2D>("Textures\\star"));
            textures.Add(Content.Load <Texture2D>("Textures\\diamond"));
            particleEngine = new ParticleEngine(textures, new Vector2(100, 40));

            //ExitPosition = new Vector3(1405.1f, .90952f, -2367.78f);
            ExitPosition   = new Vector3(2000, 0f, 2000);
            ExitPosition.Y = getHeight(ExitPosition) + 50f;
            ExitBox        = new BoundingBox(ExitPosition - new Vector3(50, 50, 50), ExitPosition + new Vector3(50, 50, 50));
            for (int x = 0; x < 50; x++)
            {
                Vector3 Pos = new Vector3(RandomNumber(-2000, 2000), 0, RandomNumber(-2000, 2000));
                //Vector3 Pos = new Vector3(0, 0, 0);
                Vector3 Normal;
                float   Height;
                heightMap.GetHeightAndNormal(Pos, out Height, out Normal);
                Pos.Y = Height + 20;
                //System.Diagnostics.Debug.WriteLine(Pos);
                coinList.Add(new Coin(Pos, content));
            }
            for (int x = 0; x < 20; x++)
            {
                Vector3 Pos    = new Vector3(RandomNumber(-2500, 3000), 0, RandomNumber(-2500, 3000));
                Vector3 Normal = new Vector3();
                float   Height = 10;
                heightMap.GetHeightAndNormal(Pos, out Height, out Normal);
                Pos.Y = Height + 50;
                //System.Diagnostics.Debug.WriteLine(Pos);
                teleporterList.Add(new teleporter(Pos, content));
            }
        }
Beispiel #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(device);
            spriteFont = content.Load<SpriteFont>("Arial");

            camera = new ChaseCamera(heightMap);
            // Set the camera offsets
            camera.DesiredPositionOffset = new Vector3(0.0f, 100.0f, 200.0f);
            camera.LookAtOffset = new Vector3(0f, 15.0f, 30.0f);

            ball = new Ball(this, device, "Models\\balltest");
            ball.scale = Vector3.One * 15f;

            camera.NearPlaneDistance = 10.0f;
            camera.FarPlaneDistance = 100000.0f;
            camera.AspectRatio = (float)device.Viewport.Width /
               device.Viewport.Height;
            camera.ChasePosition = ball.position;
            camera.ChaseDirection = ball.Direction;
            camera.Up = ball.Up;
            camera.Reset();

            ballModel = content.Load<Model>("Models\\balltest");
            pitModel = content.Load<Model>("Models\\ground");
            boxModel = content.Load<Model>("Models\\cube");
            arrowModel = content.Load<Model>("Models\\arrow");
            exitModel = content.Load<Model>("Models\\exit2");
            //exitModelText = content.Load<Model>("Models\\exitSign");
            ballTextureBeach = content.Load<Texture2D>("Textures\\beach");
            ballTextureMetal = content.Load<Texture2D>("Textures\\metal");
            ballTextureAir = content.Load<Texture2D>("Textures\\air");
            coinTexture = content.Load<Texture2D>("Textures\\coin");
            teleporterTexture = content.Load<Texture2D>("Textures\\teleporter");
            terrainModel = content.Load<Model>(terrain);
            rockTexture = content.Load<Texture2D>(terrainTexture);
            pitTextureLava = content.Load<Texture2D>("Textures\\lava");
            pitTextureIce = content.Load<Texture2D>("Textures\\3");
            scoreboardTexture = content.Load<Texture2D>("Textures\\highscores");
            heightMap = terrainModel.Tag as HeightMapInfo;
            if (heightMap == null)
            {
                string message = "The terrain model did not have a HeightMapInfo";
                throw new InvalidOperationException(message);
            }
            Sound.playSoundLoop(background, content);
            effect = content.Load<Effect>("Lighting/Effects");
            sky = content.Load<Sky>("Textures\\sky");

            /*Initialize properties for each ball*/
            beachBallProperties = new BallProperties(ballTextureBeach, 1.0f, 0.5f, 900f, 1f, new Vector3(0.97f, 1f, 0.97f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall");
            metalBallProperties = new BallProperties(ballTextureMetal, 3.0f, 0.15f, 750f, 3f, new Vector3(0.95f, 1f, 0.95f), new Vector3(1f, 1f, 1f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall");
            airBallProperties = new BallProperties(ballTextureAir, 1f, 0.05f, 1200f, 0.8f, new Vector3(0.99f, 0.99f, 0.99f), new Vector3(0.99f, 0.99f, 0.99f), "Sound\\jump", "Sound\\jump", "Sound\\changeBall");
            currentBallProperties = beachBallProperties;

            List<Texture2D> textures = new List<Texture2D>();
            textures.Add(Content.Load<Texture2D>("Textures\\circle"));
            textures.Add(Content.Load<Texture2D>("Textures\\star"));
            textures.Add(Content.Load<Texture2D>("Textures\\diamond"));
            particleEngine = new ParticleEngine(textures, new Vector2(100, 40));

            //ExitPosition = new Vector3(1405.1f, .90952f, -2367.78f);
            ExitPosition = new Vector3(2000, 0f, 2000);
            ExitPosition.Y = getHeight(ExitPosition) + 50f;
            ExitBox = new BoundingBox(ExitPosition - new Vector3(50, 50, 50), ExitPosition + new Vector3(50, 50, 50));
            for (int x = 0; x < 50; x++)
            {
                Vector3 Pos = new Vector3(RandomNumber(-2000, 2000), 0, RandomNumber(-2000, 2000));
                //Vector3 Pos = new Vector3(0, 0, 0);
                Vector3 Normal;
                float Height;
                heightMap.GetHeightAndNormal(Pos, out Height, out Normal);
                Pos.Y = Height + 20;
                //System.Diagnostics.Debug.WriteLine(Pos);
                coinList.Add(new Coin(Pos, content));
            }
            for (int x = 0; x < 20; x++)
            {
                Vector3 Pos = new Vector3(RandomNumber(-2500, 3000), 0, RandomNumber(-2500, 3000));
                Vector3 Normal = new Vector3();
                float Height = 10;
                heightMap.GetHeightAndNormal(Pos, out Height, out Normal);
                Pos.Y = Height + 50;
                //System.Diagnostics.Debug.WriteLine(Pos);
                teleporterList.Add(new teleporter(Pos, content));
            }
        }