コード例 #1
0
 public void Update()
 {
     foreach (Guid vesselID in currentVesselUpdates.Keys)
     {
         //Not sure if this can happen, but we don't want to apply updates to vessels we are supposed to be updating.
         if (lockSystem.LockIsOurs("update-" + vesselID))
         {
             continue;
         }
         Vessel updateVessel = FlightGlobals.fetch.vessels.Find(v => v.id == vesselID);
         if (updateVessel == null)
         {
             continue;
         }
         if (!updateVessel.packed)
         {
             continue;
         }
         VesselUpdate vu = currentVesselUpdates[vesselID];
         //Apply updates for up to 5 seconds
         double timeDiff = Planetarium.GetUniversalTime() - vu.planetTime;
         if (timeDiff < 5f && timeDiff > -5f)
         {
             vu.Apply(posistionStatistics, null);
         }
     }
 }
コード例 #2
0
 public void Update()
 {
     foreach (Guid vesselID in currentVesselUpdates.Keys)
     {
         //Not sure if this can happen, but we don't want to apply updates to vessels we are supposed to be updating.
         if (lockSystem.LockIsOurs("update-" + vesselID))
         {
             continue;
         }
         Vessel updateVessel = FlightGlobals.fetch.vessels.Find(v => v.id == vesselID);
         if (updateVessel == null)
         {
             continue;
         }
         if (!updateVessel.packed && !dmpSettings.interframeEnabled)
         {
             return;
         }
         if (dmpSettings.interpolatorType == InterpolatorType.DISABLED)
         {
             return;
         }
         VesselUpdate vu = currentVesselUpdates[vesselID];
         VesselUpdate pu = null;
         if (previousVesselUpdates.ContainsKey(vesselID))
         {
             pu = previousVesselUpdates[vesselID];
         }
         VesselUpdate nu = null;
         if (nextVesselUpdates.ContainsKey(vesselID))
         {
             nu = nextVesselUpdates[vesselID];
         }
         //Apply updates for up to 5 seconds
         double timeDiff = Planetarium.GetUniversalTime() - vu.planetTime;
         if (timeDiff < 5f && timeDiff > -5f)
         {
             vu.Apply(posistionStatistics, null, pu, nu, dmpSettings);
         }
     }
 }