Exemple #1
0
        // This method is used when the player's state is a spark. Sand interferes with the spark and shrinks it.
        public void OverSand(Game game, float waterLevel)
        {
            LittleFlame player = (LittleFlame)game.Services.GetService(typeof(LittleFlame));

            // This should not happen when the player is over water
            if (player != null && ground[(int)player.Position.X, (int)player.Position.Z].Grounds == (int)Ground.GroundTypes.SAND &&
                GetHeightAtPosition(player.Position.X, player.Position.Z, 0).Y > waterLevel)
            {
                // Shrink the flame
                player.overSand();
            }
        }
Exemple #2
0
        public override void Initialize()
        {
            player = (LittleFlame)Game.Services.GetService(typeof(LittleFlame));

            normalGrassSizeMod = -0.7f;
            dryGrassSizeMod    = 0.4f;
            sandSizeMod        = -1;
            ashSizeMod         = -1;
            rockSizeMod        = -1;

            smooth = 10f;

            worldMatrix    = Matrix.Identity;
            lightDirection = new Vector3(1, 0.5f, 1);

            base.Initialize();
        }
Exemple #3
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;
            }
        }
Exemple #4
0
        public override void Draw(GameTime gameTime)
        {
            LittleFlame player = (LittleFlame)game.Services.GetService(typeof(LittleFlame));
            float       flameSize;

            if (player != null)
            {
                flameSize = player.FlameSize;
            }
            else
            {
                flameSize = 0;
            }

            EffectParameterCollection parameters = particleEffect.Parameters;

            parameters["StartSize"].SetValue(new Vector2((flameSize - (flameSize * sizeDiff)) * sizeMod, (flameSize + (flameSize * sizeDiff)) * sizeMod));
            parameters["EndSize"].SetValue(new Vector2((flameSize - (flameSize * sizeDiff)) * sizeMod, (flameSize + (flameSize * sizeDiff)) * sizeMod));

            base.Draw(gameTime);
        }