Esempio n. 1
0
        internal override string GetLabel(Vessel vessel, EvaluationContext context, SubRequirementState state)
        {
            AltitudeState altitudeState = (AltitudeState)state;

            if (min != 0 && altitudeState.distance < min)
            {
                return(Lib.Color("#KerCon_TooLow", Lib.Kolor.Red));                // too low
            }
            if (max != 0 && altitudeState.distance > max)
            {
                return(Lib.Color("#KerCon_TooHigh", Lib.Kolor.Red));
            }

            return(Lib.Color("#KerCon_AltOK", Lib.Kolor.Green));            // Alt. OK
        }
Esempio n. 2
0
        internal override SubRequirementState VesselMeetsCondition(Vessel vessel, EvaluationContext context)
        {
            AltitudeState state = new AltitudeState();

            state.distance = context.Altitude(vessel);

            double minAlt = min != 0 ? min : minR * context.targetBody.Radius;
            double maxAlt = max != 0 ? max : maxR * context.targetBody.Radius;

            state.requirementMet = true;

            if (minAlt != 0 && state.distance < minAlt)
            {
                state.requirementMet = false;
            }
            if (maxAlt != 0 && state.distance > maxAlt)
            {
                state.requirementMet = false;
            }

            return(state);
        }