Beispiel #1
0
 public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D smokeSprite)
 {
     Color color = new Color(fade, fade, fade, fade);
     Vector2 vec = cam.scaleSmoke(position.X, position.Y);
     spriteBatch.Draw(smokeSprite, vec,
     null, color, rotation, Vector2.Zero, this.size, SpriteEffects.None, 0f);
 }
        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);
                }
            }
        }
        /// <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);
            camera = new Camera(graphics.GraphicsDevice.Viewport);
            gameArea = new Texture2D(graphics.GraphicsDevice, 1, 1);
            gameArea.SetData<Color>(new Color[]
                {
                    Color.White
                });

            smokeHandler = new SmokeHandler();
            gameView = new GameController(smokeHandler, graphics);
            smokeSprite = Content.Load<Texture2D>("particlesmoke");
            // TODO: use this.Content to load your game content here
        }