コード例 #1
0
        /// <summary>
        /// Removes the vessel from the dictionaries
        /// </summary>
        public void RemoveVessel(Guid vesselId)
        {
            FlyByWireDictionary.TryRemove(vesselId, out _);
            CurrentFlightState.TryRemove(vesselId, out _);
            TargetFlightStateQueue.TryRemove(vesselId, out _);

            var vessel = FlightGlobals.FindVessel(vesselId);

            if (vessel != null)
            {
                TryRemoveCallback(vessel);
            }
        }
コード例 #2
0
        /// <summary>
        /// Removes the vessel from the dictionaries
        /// </summary>
        public void RemoveVessel(Vessel vesselToRemove)
        {
            if (vesselToRemove == null)
            {
                return;
            }

            TryRemoveCallback(vesselToRemove);

            FlyByWireDictionary.TryRemove(vesselToRemove.id, out _);
            CurrentFlightState.TryRemove(vesselToRemove.id, out _);
            TargetFlightStateQueue.TryRemove(vesselToRemove.id, out _);
        }
コード例 #3
0
        /// <summary>
        /// Clear the delegates and the dictionaries
        /// </summary>
        public void ClearSystem()
        {
            foreach (var keyVal in FlyByWireDictionary)
            {
                var vessel = FlightGlobals.FindVessel(keyVal.Key);
                if (vessel != null)
                {
                    try
                    {
                        vessel.OnFlyByWire -= FlyByWireDictionary[keyVal.Key];
                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
            }

            FlyByWireDictionary.Clear();
            CurrentFlightState.Clear();
            TargetFlightStateQueue.Clear();
        }