Esempio n. 1
0
 public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D smokeSprite)
 {
     Color color = new Color(fade, fade, fade, fade);
     Vector2 vec = cam.scaleParticle(position.X, position.Y);
     spriteBatch.Draw(smokeSprite, vec,
     null, color, rotation, Vector2.Zero, this.size, SpriteEffects.None, 0f);
 }
Esempio n. 2
0
        public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D texture, Rectangle gameWindow)
        {
            Vector2 vec = cam.scaleParticle(position.X, position.Y);

                spriteBatch.Draw(texture, vec,
                null, Color.White, 0f, Vector2.Zero, this.radius, SpriteEffects.None, 0f);
        }
Esempio n. 3
0
 public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D texture)
 {
     for (int i = 0; i < MaxParticles; i++)
         {
             sparkParticles[i].Draw(spriteBatch, cam, texture, gameWindow);
         }
 }
        public void Draw(SpriteBatch spriteBatch, Texture2D texture, Camera camera)
        {
            x = frameIndex % frameX;
            y = frameIndex / frameX;
            Vector2 vec = new Vector2(position.X, position.Y);

            rect = new Rectangle(x*frameWidth, y*frameWidth, frameHeight, frameWidth);

            spriteBatch.Draw(texture, camera.scaleParticle(position.X, position.Y), rect, Color.White,
                0.0f, origin, 1.0f, SpriteEffects.None, 0.0f);
        }
Esempio n. 5
0
        public void DrawAndUpdate(SpriteBatch spriteBatch, Camera cam, Texture2D smokeSprite, float totalSeconds)
        {
            foreach (Smoke smoke in smokes)
            {
                smoke.Update(totalSeconds);

                if (smoke.IsParticleAlive())
                {
                    smoke.Draw(spriteBatch, cam, smokeSprite);
                }
            }
        }
 public GameController(Texture2D spark, Texture2D smoke, Texture2D explosion, Rectangle gameWindow,
     Vector2 startPosition, SpriteBatch spriteBatch, Camera camera, SoundEffect explosionSound)
 {
     this.spark = spark;
     this.smoke = smoke;
     this.explosion = explosion;
     this.gameWindow = gameWindow;
     this.startPosition = startPosition;
     this.spriteBatch = spriteBatch;
     this.camera = camera;
     this.explosionSound = explosionSound;
     sparkSystem = new SparkSystem(startPosition);
     smokeSystem = new SmokeSystem(startPosition);
     explosionSystem = new ExplosionSystem(startPosition, explosionSound);
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spark = Content.Load<Texture2D>("spark");
            smoke = Content.Load<Texture2D>("particlesmoke");
            explosion = Content.Load<Texture2D>("explosion");
            //Vector2 startPosition = new Vector2(graphics.GraphicsDevice.Viewport.Bounds.Width / 2.0f, graphics.GraphicsDevice.Viewport.Bounds.Height / 2.0f);
            camera = new Camera(graphics.GraphicsDevice.Viewport);
            Vector2 startPosition = new Vector2(0.5f, 0.5f);
            gameWindow = camera.GetGameWindow();
            gameView = new GameController(spark, smoke, explosion, gameWindow, startPosition);
             ss = new SmokeSystem();
             gameView.Initiate();

            // TODO: use this.Content to load your game content here
        }
        public void Draw(SpriteBatch spriteBatch, float totalSeconds, Camera camera)
        {
            time += totalSeconds;

            explosionSystem.Draw(spriteBatch, explosion, camera);

            spriteBatch.Begin();

            sparkSystem.Draw(spriteBatch, camera, spark);
            sparkSystem.Update(totalSeconds);

            if (sparkSystem.CheckIfDone())
            {
                smokeSystem.DrawAndUpdate(spriteBatch, camera, smoke, totalSeconds);
            }

            spriteBatch.End();
        }
        public void Draw(SpriteBatch spriteBatch, float totalSeconds, Camera camera)
        {
            time += totalSeconds;

            spriteBatch.Begin();
            foreach (ExplosionSystem es in explosions)
            {
                es.Draw(spriteBatch, explosion, camera);
            }
            foreach (SparkSystem ss in sparks)
            {
                ss.Update(totalSeconds);
                ss.Draw(spriteBatch, camera, spark);
            }

            foreach (SmokeSystem smokeSystem in smokes)
            {
                smokeSystem.DrawAndUpdate(spriteBatch, camera, smoke, totalSeconds);
            }

            spriteBatch.End();
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spark = Content.Load<Texture2D>("spark");
            smoke = Content.Load<Texture2D>("particlesmoke");
            explosion = Content.Load<Texture2D>("explosion");
            fireSound = Content.Load<SoundEffect>("firesound.wav");
            camera = new Camera(graphics.GraphicsDevice.Viewport);
            Vector2 startPosition = new Vector2(0.5f, 0.5f);
            gameWindow = camera.GetGameWindow();
            gameView = new GameController(spark, smoke, explosion, gameWindow, startPosition, spriteBatch, camera, fireSound);
            smokeSystem = new SmokeSystem();

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