/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } drawTime += (float)gameTime.ElapsedGameTime.TotalSeconds; if (drawTime <= maxTime) { gameView.UpdateExplosion((float)gameTime.ElapsedGameTime.TotalSeconds); time += (float)gameTime.ElapsedGameTime.TotalSeconds; if (time >= (float)ss.ParticleLifeTime / (float)ss.MaxParticles) { //gameView.UpdateSmoke((float)gameTime.ElapsedGameTime.TotalSeconds); gameView.UpdateSmoke(drawTime); time = 0; } } else { drawTime = 0; gameView.Initiate(); } // TODO: Add your update logic here base.Update(gameTime); }
/// <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 }
/// <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 }