GetBodyByName() 공개 정적인 메소드

public static GetBodyByName ( String name ) : CelestialBody
name String
리턴 CelestialBody
예제 #1
0
        public override void AddTo(SharedObjects shared)
        {
            _shared = shared;

            _shared.BindingMgr.AddSetter("TARGET", delegate(CPU cpu, object val)
            {
                if (val is ITargetable)
                {
                    VesselUtils.SetTarget((ITargetable)val);
                }
                else if (val is VesselTarget)
                {
                    VesselUtils.SetTarget(((VesselTarget)val).target);
                }
                else if (val is BodyTarget)
                {
                    VesselUtils.SetTarget(((BodyTarget)val).target);
                }
                else
                {
                    var body = VesselUtils.GetBodyByName(val.ToString());
                    if (body != null)
                    {
                        VesselUtils.SetTarget(body);
                        return;
                    }

                    var vessel = VesselUtils.GetVesselByName(val.ToString(), _shared.Vessel);
                    if (vessel != null)
                    {
                        VesselUtils.SetTarget(vessel);
                        return;
                    }
                }
            });

            _shared.BindingMgr.AddGetter("TARGET", delegate(CPU cpu)
            {
                var currentTarget = FlightGlobals.fetch.VesselTarget;

                if (currentTarget is Vessel)
                {
                    return(new VesselTarget((Vessel)currentTarget, _shared.Vessel));
                }
                else if (currentTarget is CelestialBody)
                {
                    return(new BodyTarget((CelestialBody)currentTarget, _shared.Vessel));
                }

                return(null);
            });
        }
예제 #2
0
 public BodyTarget(String name, ExecutionContext context) : this(VesselUtils.GetBodyByName(name), context)
 {
 }
예제 #3
0
 public BodyTarget(String name, Vessel currentVessel) : this(VesselUtils.GetBodyByName(name), currentVessel)
 {
 }