示例#1
0
    private void GenerateWorld()
    {
        int planetQuantity    = UnityEngine.Random.Range(MIN_PLANETS_QUANTITY, MAX_PLANETS_QUANTITY);
        int playerPlanetIndex = UnityEngine.Random.Range(0, planetQuantity);

        planets = new List <GameObject>();
        for (int i = 0; i < planetQuantity; i++)
        {
            GameObject newPlanet;
            if (i == playerPlanetIndex)
            {
                newPlanet    = planetFactory.CreatePlayerPlanet(i);
                playerPlanet = newPlanet;
            }
            else
            {
                newPlanet = planetFactory.CreateEnemyPlanet(i);
            }
            planets.Add(newPlanet);
        }
    }