Пример #1
0
        /// <summary>
        /// Remove the vessels that didn't receive and update after the value specified in MsWithoutUpdatesToRemove every 5 seconds
        /// </summary>
        private IEnumerator RemoveVessels()
        {
            var seconds = new WaitForSeconds(RemoveVesselsSecInterval);

            while (true)
            {
                try
                {
                    if (!Enabled)
                    {
                        break;
                    }

                    if (PositionUpdateSystemBasicReady)
                    {
                        var vesselsToRemove = InterpolationSystem.CurrentVesselUpdate
                                              .Where(u => u.Value.InterpolationFinished && Time.time - u.Value.FinishTime > MaxSecWithoutUpdates)
                                              .Select(u => u.Key).ToArray();

                        foreach (var vesselId in vesselsToRemove)
                        {
                            InterpolationSystem.RemoveVessel(vesselId);
                            ReceivedUpdates.Remove(vesselId);
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.LogError($"[LMP]: Coroutine error in RemoveVessels {e}");
                }

                yield return(seconds);
            }
        }
Пример #2
0
 public override void OnEnabled()
 {
     base.OnEnabled();
     Client.Singleton.StartCoroutine(InterpolationSystem.AdjustInterpolationLengthFactor());
     Client.Singleton.StartCoroutine(RemoveVessels());
     Client.Singleton.StartCoroutine(SendSecondaryVesselPositionUpdates());
 }
Пример #3
0
 public override void FixedUpdate()
 {
     base.FixedUpdate();
     if (PositionUpdateSystemReady)
     {
         InterpolationSystem.FixedUpdate();
         SendVesselPositionUpdates();
     }
 }
Пример #4
0
 public override void OnDisabled()
 {
     base.OnDisabled();
     InterpolationSystem.ResetSystem();
     ReceivedUpdates.Clear();
 }