Пример #1
0
        public virtual void Tick(GameInput input)
        {
            particles.Tick();
            if (door != null)
            {
                door.Tick();
            }
            items.Tick(input);
            enemyBullets.Tick(players);
            playerBullets.Tick(enemies);
            enemies.Tick(input);
            if (player != null)
            {
                player.Tick(input);
            }
            backgroundParticles.Tick();

            foreach (Thing enemy in enemyAddList)
            {
                enemies.AddThing(enemy);
            }
            enemyAddList.Clear();
            foreach (Particle particle in particleAddList)
            {
                particles.AddParticle(particle);
            }
            particleAddList.Clear();

            if (player != null)
            {
                MoveCamera(player.Focus);
            }

            players.SweepRemovedThings();
            enemies.SweepRemovedThings();
            playerBullets.SweepRemovedBullets();
            enemyBullets.SweepRemovedBullets();
            items.SweepRemovedThings();
            particles.SweepRemovedParticles();
            backgroundParticles.SweepRemovedParticles();

            if (quakeRadius > 0)
            {
                double angle = 2 * Math.PI * random.NextDouble();
                quakeVector  = quakeRadius * new Vector(Math.Cos(angle), Math.Sin(angle));
                quakeRadius -= 0.25;
            }

            if (flash > 0)
            {
                flash--;
            }

            numTicks++;
            if (cleared)
            {
                if (clearTimer < 16)
                {
                    clearTimer++;
                }
            }

            if (input.Exit && !gameover)
            {
                gameover      = true;
                gameoverTimer = 240;
            }

            if (player != null)
            {
                if (player.Removed)
                {
                    gameover = true;
                }
            }

            if (gameover)
            {
                if (gameoverTimer == 240)
                {
                    StopMusic();
                }
                if (gameoverTimer < 256)
                {
                    gameoverTimer++;
                }
            }
        }