コード例 #1
0
        public void StartNewGame()
        {
            // create the walls
            CreateWalls();

            // clear out the actors list
            actors.Clear();
            // add the world actor
            WorldActor worldActor = new WorldActor(this);

            actors.Add(worldActor);
            // add the players to the actor list - they won't be removed
            for (int i = 0; i < ships.Length; i++)
            {
                actors.Add(ships[i]);
            }

            // spawn asteroids
            switch (WorldRules.AsteroidDensity)
            {
            case AsteroidDensity.None:
                break;

            case AsteroidDensity.Low:
                SpawnAsteroids(4, 3, 0);
                break;

            case AsteroidDensity.Medium:
                SpawnAsteroids(6, 4, 1);
                break;

            case AsteroidDensity.High:
                SpawnAsteroids(8, 6, 2);
                break;
            }

            // set up the power-up timer for the initial delay
            powerUpTimer = initialPowerUpDelay;

            // set up the starfield
            starfield.SetTargetPosition(dimensions * 0.5f);
        }
コード例 #2
0
        public void StartNewGame()
        {
            // create the walls
            CreateWalls();

            // clear out the actors list
            actors.Clear();
            // add the world actor
            WorldActor worldActor = new WorldActor(this);
            actors.Add(worldActor);
            // add the players to the actor list - they won't be removed
            for (int i = 0; i < ships.Length; i++)
            {
                actors.Add(ships[i]);
            }

            // spawn asteroids
            switch (WorldRules.AsteroidDensity)
            {
                case AsteroidDensity.None:
                    break;
                case AsteroidDensity.Low:
                    SpawnAsteroids(4, 3, 0);
                    break;
                case AsteroidDensity.Medium:
                    SpawnAsteroids(6, 4, 1);
                    break;
                case AsteroidDensity.High:
                    SpawnAsteroids(8, 6, 2);
                    break;
            }

            // set up the power-up timer for the initial delay
            powerUpTimer = initialPowerUpDelay;

            // set up the starfield
            starfield.SetTargetPosition(dimensions * 0.5f);
        }