예제 #1
0
        public Planet GetPlanet(ushort thingIndex)
        {
            for (int i = 0; i < planets.Count; i++)
            {
                if (planets[i].ThingIndex == thingIndex)
                {
                    return(planets[i]);
                }
            }

            if (things[thingIndex].type != (ushort)ThingType.Sun &&
                things[thingIndex].type != (ushort)ThingType.Planet &&
                things[thingIndex].type != (ushort)ThingType.Moon)
            {
                return(null);
            }

            Planet planet = universeFactory.GetPlanet(Planet.GetPlanetHeightWithRadius(things[thingIndex].radius));

            planet.InitPlanet(this, thingIndex);

            planets.Add(planet);

            return(planet);
        }