Exemple #1
0
        protected override void LoadContent()
        {
            Model eyeModel = game.Assets.Load <Model>("eyes");

            eyes = new FlameEyes(Game, eyeModel, Vector3.Zero, new Vector3(0.04f, 0.04f, 0.04f), this);
            this.Game.Components.Add(eyes);

            batch = new SpriteBatch(GraphicsDevice);
            //burningSound = this.Game.Content.Load<SoundEffect>(@"Music\SoundEffects\wind");
            //burningSoundInstance = burningSound.CreateInstance();
            //burningSoundInstance.IsLooped = true;
            //burningSoundInstance.Play();

            this.cam     = (Camera.Camera)Game.Services.GetService(typeof(Camera.Camera));
            this.terrain = (Terrain)Game.Services.GetService(typeof(Terrain));

            // Particles
            //sandParticles = new Particles.SandParticleSystem(Game, Game.Content);
            //Game.Components.Add(sandParticles);

            //Add healthbar
            Player.Healthbar healthBar = new Player.Healthbar(Game, Game.Content.Load <Texture2D>("Textures\\healthbar"), new Vector2(10, 10), 20, 300, this);
            //Player.Healthbar healthBar = new Player.Healthbar(game, game.Assets.Load<Texture2D>("healthbar"), new Vector2(10, 10), 20, this);
            Game.Components.Add(healthBar);

            meteorHud = new Player.MeteorHud(game, game.Assets.Load <Texture2D>("lockedmeteorhud"), game.Assets.Load <Texture2D>("meteorhud"), new Vector2(10, 40), new Vector2(20), 3, 5);
            Game.Components.Add(meteorHud);

            base.LoadContent();
        }
Exemple #2
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();
        }
Exemple #3
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);
        }
Exemple #4
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();
        }
Exemple #5
0
        public Sky(Game1 game, TextureCube skyTexture)
            : base(game)
        {
            this.game = game;

            //Get the camera (only littleflame camera)
            camera = (Camera.Camera)game.Services.GetService(typeof(Camera.Camera));

            //Create model
            sphereModel = new Models.LFModel(game, game.Assets.Load <Model>("skysphere"), camera.CamPos, Vector3.Zero, new Vector3(12f));
            game.Components.Add(sphereModel);

            //Load the effect
            skyEffect = game.Assets.Load <Effect>("sky");

            //Set the cubemap
            skyEffect.Parameters["CubeMap"].SetValue(skyTexture);
            sphereModel.SetModelEffect(skyEffect, false);
        }
Exemple #6
0
        // This method is called when the player is floating over sand.
        public void overSand()
        {
            const int fireParticlesPerFrame = 3;

            for (int i = 0; i < fireParticlesPerFrame; i++)
            {
                float   randomNr = (float)rnd.NextDouble() * 4 * (float)Math.PI;
                float   xpos     = Position.X + (float)Math.Cos(randomNr) * 2f;
                float   zpos     = Position.Z + (float)Math.Sin(randomNr) * 2f;
                Vector3 pos      = terrain.GetHeightAtPosition(xpos, zpos, 0);
                //sandParticles.AddParticle(pos, Vector3.Zero);
            }
            Camera.Camera cam = (Camera.Camera) this.Game.Services.GetService(typeof(Camera.Camera));
            //sandParticles.SetCamera(cam.viewMatrix, cam.projectionMatrix);

            if (Position.Y - terrain.GetHeightAtPosition(Position.X, Position.Z, 0).Y < sandHeight)
            {
                ChangeSize(sandSparkSizeMod);
            }
        }
Exemple #7
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);
        }