Esempio n. 1
0
        public WaterBase(Vector3 origin, float height, Vector2 size, String baseTextureKey, String waveTextureKey, int xRowTextures, int yRowTextures, string effectKey, int waveDensity, Game1 game)
            : base(game)
        {
            this.game           = game;
            this.origin         = origin;
            this.size           = size;
            this.baseTextureKey = baseTextureKey;
            this.waveTextureKey = waveTextureKey;
            this.xRowTextures   = xRowTextures;
            this.yRowTextures   = yRowTextures;
            this.graphicsDevice = game.GraphicsDevice;
            this.content        = game.Content;
            this.effectKey      = effectKey;
            this.waveDensity    = waveDensity;

            vertices = new VertexPositionNormalTexture[4];

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level  = (States.Level)game.Services.GetService(typeof(States.Level));

            baseEffect = new AlphaTestEffect(graphicsDevice);

            randy = new Random();

            LoadContent();

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();
            FillVertices();
            LoadWaves();
        }
Esempio n. 2
0
        public override void Draw(GameTime gameTime)
        {
            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));

            graphicsDevice.BlendState = BlendState.Opaque;

            // Set our effect to use the specified texture and camera matrices.
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            //Set the parameters of the effects
            baseEffect.Texture    = baseTexture;
            baseEffect.World      = level.World;
            baseEffect.View       = camera.viewMatrix;
            baseEffect.Projection = camera.projectionMatrix;

            baseEffect.CurrentTechnique.Passes[0].Apply();
            graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);
            graphicsDevice.BlendState = BlendState.AlphaBlend;

            //Draw the waves
            for (int i = 0; i < waves.Length; i++)
            {
                waves[i].Draw(gameTime, camera, level);
            }

            base.Draw(gameTime);
        }
Esempio n. 3
0
        public WaterBase(Vector3 origin, float height, Vector2 size, String baseTextureKey, String waveTextureKey, int xRowTextures, int yRowTextures, string effectKey, int waveDensity, Game1 game)
            : base(game)
        {
            this.game = game;
            this.origin = origin;
            this.size = size;
            this.baseTextureKey = baseTextureKey;
            this.waveTextureKey = waveTextureKey;
            this.xRowTextures = xRowTextures;
            this.yRowTextures = yRowTextures;
            this.graphicsDevice = game.GraphicsDevice;
            this.content = game.Content;
            this.effectKey = effectKey;
            this.waveDensity = waveDensity;

            vertices = new VertexPositionNormalTexture[4];

            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            baseEffect = new AlphaTestEffect(graphicsDevice);

            randy = new Random();

            LoadContent();

            //Calculates were the corner vectors of the quad are qoing to be
            CalcVertices();
            FillVertices();
            LoadWaves();
        }
Esempio n. 4
0
        public override void Draw(GameTime gameTime)
        {
            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));

            graphicsDevice.BlendState = BlendState.Opaque;

            // Set our effect to use the specified texture and camera matrices.
            level = (States.Level)game.Services.GetService(typeof(States.Level));

            //Set the parameters of the effects
            baseEffect.Texture = baseTexture;
            baseEffect.World = level.World;
            baseEffect.View = camera.viewMatrix;
            baseEffect.Projection = camera.projectionMatrix;

            baseEffect.CurrentTechnique.Passes[0].Apply();
            graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);
            graphicsDevice.BlendState = BlendState.AlphaBlend;

            //Draw the waves
            for (int i = 0; i < waves.Length; i++)
            {
                waves[i].Draw(gameTime, camera, level);
            }

            base.Draw(gameTime);
        }
Esempio n. 5
0
        public void BurningField(Vector3 flamePos, GameTime gametime, Game game, Level level)
        {
            ground[(int)flamePos.X, (int)flamePos.Z].BurnValue -= 2;
            player = (LittleFlame)Game.Services.GetService(typeof(LittleFlame));

            int burnSize = (int)player.FlameSize / 75;
            switch (ground[(int)flamePos.X, (int)flamePos.Z].Grounds) {
                case (int)Ground.GroundTypes.GRASS:
                    UpdateGrass(flamePos, burnSize, false, false, normalGrassSizeMod, 1, 0.5);
                    break;
                case (int)Ground.GroundTypes.GRASSFLOWERS:
                    UpdateGrass(flamePos, burnSize, false, true, normalGrassSizeMod, 1, 0.5);
                    break;
                case (int)Ground.GroundTypes.DRYGRASS:
                    UpdateGrass(flamePos, burnSize, true, false, dryGrassSizeMod, 0.5, 0);
                    break;
                case (int)Ground.GroundTypes.DRYGRASSFLOWERS:
                    UpdateGrass(flamePos, burnSize, true, true, dryGrassSizeMod, 0.5, 0);
                    break;
                case (int)Ground.GroundTypes.SAND:
                    NonWalkableTerrain(sandSizeMod);
                    break;
                case (int)Ground.GroundTypes.MUD:
                    NonWalkableTerrain(sandSizeMod);
                    break;
                case (int)Ground.GroundTypes.ROCK:
                    NonWalkableTerrain(rockSizeMod);
                    break;
                case (int)Ground.GroundTypes.ASH:
                    NonWalkableTerrain(ashSizeMod);
                    break;

                default: break;
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Terrain Constructor
 /// </summary>
 /// <param name="game">This game</param>
 /// <param name="heightmapKey">The key of the heightmapKey</param>
 /// <param name="graphicsdevice"></param>
 /// <param name="content"></param>
 public Terrain(Game1 game, string heightmapKey, string texturemapKey, Level level)
     : base(game)
 {
     this.game = game;
     this.heightMapKey = heightmapKey;
     this.textureMapKey = texturemapKey;
     this.graphicsDevice = game.GraphicsDevice;;
     this.content = game.Content;
     this.level = level;
 }