コード例 #1
0
        public override void Update(GameTime gameTime)
        {
            _playerRespawnTimer.Update(gameTime);


            if (_gameOver)
            {
                _gameOverTimer.Update(gameTime);
                if (_gameOverTimer.Completed)
                {
                    GameOverWaitFinished?.Invoke(this, null);
                    return;
                }
            }
            else if (_player.IsDestroyed && _playerRespawnTimer.Completed && _shotManager.ShotCount == 0 /* && _enemyManager.EnemyCount == 0*/)
            {
                //StartGame();
                SpawnPlayer();
            }

            _starField.Update(gameTime);
            _asteroidManager.Update(gameTime);
            _player.Update(gameTime);
            _shotManager.Update(gameTime);
            _enemyManager.Update(gameTime);
            _pieceExplosionManager.Update(gameTime);
            _pointExplosionManager.Update(gameTime);

            // needs to come after everything has updated as this is responsible for providing
            // input for next Update routine
            _collisionEngine.Update(gameTime);
        }
        public void Update(GameTime gameTime)
        {
            _projectileVertexList.Clear();
            for (int x = 0; x < WorldSettings.MAXPROJECTILES; x++)
            {
                if (_activeProjectiles[x])
                {
                    // Add smoke at old position
                    _bazookaSmokeParticleSystem.AddParticle(_projectilePool[x].Position, Vector3.Zero);

                    // Update positions
                    _projectilePool[x].Position += (_projectilePool[x].Velocity * (float)gameTime.ElapsedGameTime.TotalSeconds);
                    if (!CheckCollision(x))
                    {
                        AddCube(_projectilePool[x].Position, _projectilePool[x].Size, _projectilePool[x].Color);
                    }
                }
            }
            _bazookaSmokeParticleSystem.SetCamera(_game.Camera.View, _game.Camera.Projection);
            _bazookaSmokeParticleSystem.Update(gameTime);
            _explosionParticleSystem.SetCamera(_game.Camera.View, _game.Camera.Projection);
            _explosionParticleSystem.Update(gameTime);
            _explosionSmokeParticleSystem.SetCamera(_game.Camera.View, _game.Camera.Projection);
            _explosionSmokeParticleSystem.Update(gameTime);
        }