コード例 #1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            Events["CheckGoldStrike"].guiActive          = showGUI;
            Events["CheckGoldStrike"].guiActiveUncommand = showGUI;

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            //Vessel Module
            foreach (VesselModule module in this.part.vessel.vesselModules)
            {
                if (module is GoldStrikeVesselModule)
                {
                    vesselModule = (GoldStrikeVesselModule)module;
                    break;
                }
            }

            //Get asteroid (if any)
            asteroid = this.part.vessel.FindPartModuleImplementing <ModuleAsteroid>();
        }
コード例 #2
0
        public double GetDistanceFromLastLocation(Vessel vessel)
        {
            double distance = 0;

            //Pull last prospect location from the vessel module.
            GoldStrikeVesselModule vesselModule = null;

            foreach (VesselModule module in vessel.vesselModules)
            {
                if (module is GoldStrikeVesselModule)
                {
                    vesselModule = (GoldStrikeVesselModule)module;
                    break;
                }
            }
            if (vesselModule == null)
            {
                return(double.MaxValue);
            }

            //If we've never set a prospect location then we're automatically ok.
            if (!vesselModule.HasLastProspectLocation())
            {
                return(double.MaxValue);
            }

            //Calculate the distance
            distance = Utils.HaversineDistance(vesselModule.lastProspectLongitude, vesselModule.lastProspectLatitude,
                                               vessel.longitude, vessel.latitude, vessel.mainBody);

            return(distance);
        }
コード例 #3
0
ファイル: WBIGoldStrike.cs プロジェクト: MrKiel/Pathfinder
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            Events["CheckGoldStrike"].guiActive          = showGUI;
            Events["CheckGoldStrike"].guiActiveUncommand = showGUI;

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            //Minimum travel distance
            minTravelDistance = GoldStrikeSettings.DistanceBetweenProspects;
            GameEvents.OnGameSettingsApplied.Add(onGameSettingsApplied);

            //Vessel Module
            foreach (VesselModule module in this.part.vessel.vesselModules)
            {
                if (module is GoldStrikeVesselModule)
                {
                    vesselModule = (GoldStrikeVesselModule)module;
                    break;
                }
            }

            //Get asteroid (if any)
            asteroid = this.part.vessel.FindPartModuleImplementing <ModuleAsteroid>();
        }