コード例 #1
0
        public void Run()
        {
            this.soundEffects.PlayStart();

            CollisionResolver    collisionResolver    = new CollisionResolver(this.soundEffects, this.scoreContainer);
            DifficultyController difficultyController =
                new DifficultyController(
                    this.graphicalObjects,
                    this.objectGenerator,
                    this.scoreContainer);

            while (true)
            {
                Thread.Sleep(this.threadSleepTime);

                this.ReadAndProcessCommands(this.graphicalObjects);

                this.UpdateObjects();

                collisionResolver.Resolve(this.graphicalObjects);

                this.DrawObjects();

                this.scoreContainer.DrawScore();

                difficultyController.UpdateDifficulty();

                // Go to game over screen condition
                if (this.graphicalObjects.SpaceShipPlayerOne.HealthPoints == 0)
                {
                    this.soundEffects.PlayExplosion();
                    break;
                }
            }
        }