예제 #1
0
        private GUIStyle getGeeAccumStyle(KeepFitCrewMember crew, Period period, GeeLoadingAccumulator accum)
        {
            GameConfig gameConfig = scenarioModule.GetGameConfig();

            GUIStyle style = new GUIStyle(GUI.skin.label);

            style.normal.textColor = Color.green;
            style.wordWrap         = false;

            GeeToleranceConfig tolerance = gameConfig.GetGeeTolerance(period);

            if (tolerance == null)
            {
                return(style);
            }

            float geeWarn  = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.warn, crew, gameConfig);
            float geeFatal = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.fatal, crew, gameConfig);

            float gee = accum.GetLastGeeMeanPerSecond();

            if (gee > geeFatal)
            {
                style.normal.textColor = Color.red;
            }
            else
            {
                if (gee > geeWarn)
                {
                    style.normal.textColor = Color.yellow;
                }
            }

            return(style);
        }
        private GeeLoadingOutCome handleGeeLoadingUpdate(KeepFitCrewMember crewMember,
                                                         float geeLoading,
                                                         float elapsedSeconds,
                                                         GeeLoadingAccumulator accum,
                                                         GeeToleranceConfig tolerance,
                                                         float healthGeeToleranceModifier)
        {
            float meanG;

            if (accum.AccumulateGeeLoading(geeLoading, elapsedSeconds, out meanG))
            {
                float geeWarn  = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.warn, crewMember, gameConfig);
                float geeFatal = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.fatal, crewMember, gameConfig);

                if (meanG > geeFatal)
                {
                    return(GeeLoadingOutCome.GeeFatal);
                }
                else if (meanG > geeWarn)
                {
                    return(GeeLoadingOutCome.GeeWarn);
                }
            }

            return(GeeLoadingOutCome.Ok);
        }
예제 #3
0
        private GUIStyle getGeeAccumStyle(KeepFitCrewMember crew, Period period, GeeLoadingAccumulator accum)
        {
            GameConfig gameConfig = scenarioModule.GetGameConfig();

            GUIStyle style = new GUIStyle(GUI.skin.label);
            style.normal.textColor = Color.green;
            style.wordWrap = false;

            GeeToleranceConfig tolerance = gameConfig.GetGeeTolerance(period);
            if (tolerance == null)
            {
                return style;
            }

            float geeWarn = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.warn, crew, gameConfig);
            float geeFatal = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.fatal, crew, gameConfig);

            float gee = accum.GetLastGeeMeanPerSecond();
            if (gee > geeFatal)
            {
                style.normal.textColor = Color.red;
            }
            else
            {
                if (gee > geeWarn)
                {
                    style.normal.textColor = Color.yellow;
                }
            }

            return style;
        }
        private bool tryHandleWithGEffectsMod(KeepFitCrewMember crewMember,
                                              float geeLoading,
                                              float elapsedSeconds,
                                              GeeLoadingAccumulator accum,
                                              GeeToleranceConfig tolerance,
                                              float healthGeeToleranceModifier)
        {
            if (!gEffectsAPI.isInitialized())
            {
                return(false);
            }
            double?downwardG = gEffectsAPI.getDownwardG(crewMember.Name);
            double?forwardG  = gEffectsAPI.getForwardG(crewMember.Name);

            if ((downwardG == null) || (forwardG == null))
            {
                return(false);
            }

            //The plain (medical) sum of longitudal and lateral G loads is used for G. Also the regular vector module Math.Sqrt(Math.Pow(downwardG, 2) + Math.Pow(upwardG, 2)) may be used.
            handleGeeLoadingUpdate(crewMember, Math.Abs((float)downwardG) + Math.Abs((float)forwardG), elapsedSeconds, accum, tolerance, healthGeeToleranceModifier);
            //The outcome is ignored for not displaying warning messages because G-Effects mod has enough visual warnings itself
            return(true);
        }
        private GeeLoadingOutCome handleGeeLoadingUpdate(KeepFitCrewMember crewMember, 
                                            float geeLoading, 
                                            float elapsedSeconds, 
                                            GeeLoadingAccumulator accum, 
                                            GeeToleranceConfig tolerance,
                                            float healthGeeToleranceModifier)
        {
            
            float meanG;
            if (accum.AccumulateGeeLoading(geeLoading, elapsedSeconds, out meanG))
            {
                float geeWarn = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.warn, crewMember, gameConfig);
                float geeFatal = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.fatal, crewMember, gameConfig);

                if (meanG > geeFatal) 
                {
                    return GeeLoadingOutCome.GeeFatal;
                }
                else if (meanG > geeWarn)
                {
                    return GeeLoadingOutCome.GeeWarn;
                }
            }

            return GeeLoadingOutCome.Ok;
        }
        private bool tryHandleWithGEffectsMod(KeepFitCrewMember crewMember, 
                                            float geeLoading, 
                                            float elapsedSeconds, 
                                            GeeLoadingAccumulator accum, 
                                            GeeToleranceConfig tolerance,
                                            float healthGeeToleranceModifier) {
			if (! gEffectsAPI.isInitialized()) {
        		return false;
        	}
        	double? downwardG = gEffectsAPI.getDownwardG(crewMember.Name);
			double? forwardG = gEffectsAPI.getForwardG(crewMember.Name);
			if ((downwardG == null) || (forwardG == null)) {
				return false;
			}
			
			//The plain (medical) sum of longitudal and lateral G loads is used for G. Also the regular vector module Math.Sqrt(Math.Pow(downwardG, 2) + Math.Pow(upwardG, 2)) may be used.
			handleGeeLoadingUpdate(crewMember, Math.Abs((float)downwardG) + Math.Abs((float)forwardG), elapsedSeconds, accum, tolerance, healthGeeToleranceModifier);
			//The outcome is ignored for not displaying warning messages because G-Effects mod has enough visual warnings itself  
			return true;        	
        }
 internal GeeLoadingAccumulatorAndPeriod(Period period, GeeLoadingAccumulator accum)
 {
     this.period = period;
     this.accum = accum;
 }
예제 #8
0
 internal GeeLoadingAccumulatorAndPeriod(Period period, GeeLoadingAccumulator accum)
 {
     this.period = period;
     this.accum  = accum;
 }