Protractor.ProtractorData.getplanets C# (CSharp) 메소드

getplanets() 공개 메소드

public getplanets ( ) : void
리턴 void
        public void getplanets()
        {
            if (planets != null)
            {
                planets.Clear();
            } else {
                planets = new List<CelestialBody>();
            }

            // Not in flight, assume we're on Kerbin and don't use vessel
            if (!HighLogic.LoadedSceneIsFlight)
            {
                foreach (CelestialBody body in Sun.orbitingBodies)
                {
                    if (body.name != "Kerbin")
                    {
                        planets.Add(body);
                    }
                }
            }
            // In flight, so use current vessel
            else
            {
                foreach (CelestialBody body in bodyList)
                {
                    if (body.referenceBody == Planetarium.fetch.Sun)
                    {
                        if (body == Sun || body == FlightGlobals.ActiveVessel.mainBody || body == FlightGlobals.ActiveVessel.mainBody.referenceBody)
                        {
                            continue;
                        }
                        planets.Add(body);
                    }
                }
            }
        }