Esempio n. 1
0
        internal void CheckState(IFlightCorridor flightCorridor)
        {
            var flightState = new FlightStateData(FlightGlobals.ActiveVessel);

            if (State == RangeState.Nominal || State == RangeState.Armed)
            {
                var previousStatus = flightCorridor.Status;
                var currentStatus  = flightCorridor.CheckStatus(flightState);
                if (previousStatus != currentStatus)
                {
                    if ((currentStatus & FlightStatus.AnySafe) != 0)
                    {
                        EnterSafeState(currentStatus);
                    }
                    else if (State == RangeState.Nominal)
                    {
                        if ((currentStatus & FlightStatus.AnyViolation) != 0)
                        {
                            // there has been a status change and we are no longer nominal
                            EnterArmedState(currentStatus);
                        }
                    }
                    else if (State == RangeState.Armed)
                    {
                        if ((currentStatus & FlightStatus.AnyViolation) == 0)
                        {
                            // there has been a status change and we can potentially revert from armed to nominal
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 protected void Start()
 {
     try
     {
         settings       = Settings.InstantiateFromConfig();
         flightCorridor = FlightCorridorBase.InstantiateFromConfig();
         flightCorridor.SystemSettings = settings;
         flightRange = new FlightRange();
         flightRange.Initialize(this);
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }