/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here position.X = 0.5f; position.Y = 0.5f; splitterSystem = new SplitterSystem(GraphicsDevice.Viewport, position); shockwave = new ShockWave(GraphicsDevice.Viewport, position, Content); base.Initialize(); }
public ApplicationView(Texture2D smokeTexture, Texture2D splitterTexture, Texture2D explosionTexture, Texture2D shockwaveTexture, Camera camera, SpriteBatch spriteBatch) { _smokeTexture = smokeTexture; _splitterTexture = splitterTexture; _explosionTexture = explosionTexture; _shockwaveTexture = shockwaveTexture; _camera = camera; _spriteBatch = spriteBatch; explosion = new Explosion(_explosionTexture, _camera); smokeSystem = new SmokeSystem(_smokeTexture, explosionPos); splitterSystem = new SplitterSystem(_splitterTexture, explosionPos); }
public void InitiateParticleSystem() { Vector2 startPosition = new Vector2(0.5f, 0.5f); splitterSystem = new SplitterSystem(startPosition); }
public override void Update(Microsoft.Xna.Framework.GameTime a_gameTime) { //Handle paused state if (m_isPaused) { if (m_gameView.DidPlayerPressQuit()) { m_handlerEvent.Invoke(this, new EventArgs()); } if (m_gameView.DidPlayerPressPause()) { m_isPaused = !m_isPaused; } } else if (m_levelComplete) { if (m_gameView.DidPlayerPressQuit()) { if (m_currentLevel == CurrentLevel.END) { m_handlerEvent.Invoke(this, new EventArgs()); } else { ResetGameAtCurrentLevel(); } } } else if (m_gameModel.IsPlayerDead()) { //Add an if for a timer here, so if the timer is under 1sec or w/e, these ifs don't run. When that's done, destroy the particles and display the death screen like before. if (m_deathAnimationTimer < m_deathAnimationEnd) { m_deathAnimationTimer += (float)a_gameTime.ElapsedGameTime.TotalSeconds; } else if (m_gameView.DidPlayerPressPause()) { m_handlerEvent.Invoke(this, new EventArgs()); } else if (m_gameView.DidPlayerPressQuit()) { ResetGameAtCurrentLevel(); } if (m_deathAnimationTimer > m_deathAnimationEnd && m_particles != null) { m_particles = null; } else if (m_particles != null) { m_particles.Update(a_gameTime); } } else { if (m_gameView.DidPlayerPressPause()) { m_isPaused = !m_isPaused; } //Input handling if (m_gameView.DidPlayerMoveLeft()) { m_gameModel.movePlayerLeft(); } else if (m_gameView.DidPlayerMoveRight()) { m_gameModel.movePlayerRight(); } else { m_gameModel.StopPlayerMovingSideways(); } if (m_gameView.DidPlayerJump()) { if (m_gameModel.Jump()) { m_gameView.PlayJumpSound(); } } m_gameModel.Update((float)a_gameTime.ElapsedGameTime.TotalSeconds, m_camera); if (m_level.DidPlayIntersectWithLethalTile()) { m_gameModel.KillPlayer(); Vector2 playerPos = m_gameModel.GetPlayerPos(); m_particles = new SplitterSystem(playerPos); m_particles.LoadContent(m_content); m_gameView.PlayDeathSound(); } } if (m_level.DidPlayerHitPortal() && !m_levelComplete) { m_currentLevel++; m_levelComplete = true; } m_gameView.UpdateKeyboard(); base.Update(a_gameTime); }
public void createParticle() { Vector2 startPosition = new Vector2(0.5f, 0.5f); particle = new SplitterSystem(startPosition); }
public void createExplosion() { explosion = new Explosion(_explosionTexture, _camera); smokeSystem = new SmokeSystem(_smokeTexture, explosionPos); splitterSystem = new SplitterSystem(_splitterTexture, explosionPos); }