当前位置: 首页>>代码示例>>C#>>正文


C# FloatCurve.Add方法代码示例

本文整理汇总了C#中FloatCurve.Add方法的典型用法代码示例。如果您正苦于以下问题:C# FloatCurve.Add方法的具体用法?C# FloatCurve.Add怎么用?C# FloatCurve.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FloatCurve的用法示例。


在下文中一共展示了FloatCurve.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoAeroForces

        public static Vector3 DoAeroForces(MissileLauncher ml, Vector3 targetPosition, float liftArea, float steerMult, Vector3 previousTorque, float maxTorque, float maxAoA)
        {
            if(DefaultLiftCurve == null)
            {
                DefaultLiftCurve = new FloatCurve();
                DefaultLiftCurve.Add(0, 0);
                DefaultLiftCurve.Add(8, .35f);
            //	DefaultLiftCurve.Add(19, 1);
            //	DefaultLiftCurve.Add(23, .9f);
                DefaultLiftCurve.Add(30, 1.5f);
                DefaultLiftCurve.Add(65, .6f);
                DefaultLiftCurve.Add(90, .7f);
            }

            if(DefaultDragCurve == null)
            {
                DefaultDragCurve = new FloatCurve();
                DefaultDragCurve.Add(0, 0.00215f);
                DefaultDragCurve.Add(5, .00285f);
                DefaultDragCurve.Add(15, .007f);
                DefaultDragCurve.Add(29, .01f);
                DefaultDragCurve.Add(55, .3f);
                DefaultDragCurve.Add(90, .5f);
            }

            FloatCurve liftCurve = DefaultLiftCurve;
            FloatCurve dragCurve = DefaultDragCurve;

            return DoAeroForces(ml, targetPosition, liftArea, steerMult, previousTorque, maxTorque, maxAoA, liftCurve, dragCurve);
        }
开发者ID:gomker,项目名称:BDArmory,代码行数:30,代码来源:MissileGuidance.cs

示例2: ProcessNodeAsFloatCurve

 public FloatCurve ProcessNodeAsFloatCurve(ConfigNode node)
 {
     FloatCurve resultCurve = new FloatCurve();
     ConfigNode[] moduleNodeArray = node.GetNodes(nodeName);
     debugMessage("ProcessNodeAsFloatCurve: moduleNodeArray.length " + moduleNodeArray.Length);
     for (int k = 0; k < moduleNodeArray.Length; k++)
     {
         debugMessage("found node");
         string[] valueArray = moduleNodeArray[k].GetValues(valueName);
         debugMessage("found " + valueArray.Length + " values");
         for (int l = 0; l < valueArray.Length; l++)
         {
             string[] splitString = valueArray[l].Split(' ');
             try
             {
                 Vector2 v2 = new Vector2(float.Parse(splitString[0]), float.Parse(splitString[1]));
                 resultCurve.Add(v2.x, v2.y, 0, 0);
             }
             catch
             {
                 Debug.Log("Error parsing vector2");
             }
         }
     }
     return resultCurve;
 }
开发者ID:Yitscar,项目名称:KSPInterstellar,代码行数:26,代码来源:InterstellarNodeLoader.cs

示例3: OnAwake

 public override void OnAwake()
 {
     base.OnAwake();
     if (heatCurve == null)
     {
         heatCurve = new FloatCurve();
         heatCurve.Add(0, 0.00002f);//very minimal initial ablation factor
         heatCurve.Add(50, 0.00005f);//ramp it up fairly quickly though
         heatCurve.Add(150, 0.00015f);
         heatCurve.Add(500, 0.00050f);
         heatCurve.Add(750, 0.00075f);
         heatCurve.Add(1000, 0.00100f);
         heatCurve.Add(2000, 0.00400f);
         heatCurve.Add(3000, 0.00800f);//generally, things will explode before this point
         heatCurve.Add(10000, 0.05000f);//but just in case, continue the curve up to insane levels
     }
 }
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:17,代码来源:SSTUHeatShield.cs

示例4: OnStart

        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            intake = FindIntake();

            if (machCurve == null)
            {
                Debug.LogError("ERROR: ModuleB9AnimateIntake on part " + part.name + ": machCurve is null!");
                machCurve = new FloatCurve();
                machCurve.Add(0f, 0f);
            }
        }
开发者ID:blowfishpro,项目名称:B9AnimationModules,代码行数:12,代码来源:ModuleB9AnimateIntake.cs

示例5: EvaluateVelCpCurve

 public float EvaluateVelCpCurve(float vel)
 {
     if (protoVelCpCurve != null)
     {
         velCpCurve = new FloatCurve();
         foreach (CurveData data in protoVelCpCurve)
         {
             velCpCurve.Add(data.x, data.y, data.dy_dx, data.dy_dx);
         }
         protoTempCurve = null;
     }
     return velCpCurve.Evaluate(vel);
 }
开发者ID:kevin-ye,项目名称:DeadlyReentry,代码行数:13,代码来源:DREAtmTempCurve.cs

示例6: EvaluateTempDiffCurve

 public float EvaluateTempDiffCurve(float vel)
 {
     if(protoTempCurve != null)
     {
         tempAdditionFromVelocity = new FloatCurve();
         foreach(CurveData data in protoTempCurve)
         {
             tempAdditionFromVelocity.Add(data.x, data.y, data.dy_dx, data.dy_dx);
         }
         protoTempCurve = null;
     }
     return tempAdditionFromVelocity.Evaluate(vel);
 }
开发者ID:kevin-ye,项目名称:DeadlyReentry,代码行数:13,代码来源:DREAtmTempCurve.cs

示例7: OnAwake

 public override void OnAwake()
 {
     base.OnAwake();
     if (thrustModifier == null)
     {
         thrustModifier = new FloatCurve();
         thrustModifier.Add(0f, 1f);
     }
     if (cycle == null)
     {
         cycle = new FloatCurve();
         cycle.Add(0f, 1f);
     }
 }
开发者ID:KSP-RO,项目名称:TestFlight,代码行数:14,代码来源:TestFlightReliability_EngineCycle.cs

示例8: EvaluateTempDiffCurve

 public float EvaluateTempDiffCurve(float vel)
 {
     if(protoTempCurve != null)
     {
         tempAdditionFromVelocity = new FloatCurve();
         Debug.Log("Building Temperature Curve Object...");
         foreach(CurveData data in protoTempCurve)
         {
             tempAdditionFromVelocity.Add(data.x, data.y, data.dy_dx, data.dy_dx);
         }
         protoTempCurve = null;
     }
     return tempAdditionFromVelocity.Evaluate(vel);
 }
开发者ID:Kerbas-ad-astra,项目名称:RealHeat,代码行数:14,代码来源:AtmTempCurve.cs

示例9: FixedUpdate

		public void FixedUpdate() {
            if (HighLogic.LoadedSceneIsFlight && _attached_engine != null && _attached_reactor != null && _attached_engine.isOperational)
            {
                double max_power = _attached_reactor.MaximumChargedPower;
                if (_attached_reactor is InterstellarFusionReactor) max_power *= 0.9;
                double dilution_factor = 15000.0;
                double joules_per_amu = _attached_reactor.CurrentMeVPerChargedProduct * 1e6 * GameConstants.ELECTRON_CHARGE / dilution_factor;
                double isp = Math.Sqrt(joules_per_amu * 2.0 / GameConstants.ATOMIC_MASS_UNIT) / GameConstants.STANDARD_GRAVITY;
                FloatCurve new_isp = new FloatCurve();
                new_isp.Add(0, (float)isp, 0, 0);
                _attached_engine.atmosphereCurve = new_isp;

                double charged_power_received = consumeFNResource(max_power * TimeWarp.fixedDeltaTime * _attached_engine.currentThrottle, FNResourceManager.FNRESOURCE_CHARGED_PARTICLES) / TimeWarp.fixedDeltaTime;
                consumeFNResource(charged_power_received * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_WASTEHEAT);

                double megajoules_received = consumeFNResource(charged_power_received * TimeWarp.fixedDeltaTime * 0.01, FNResourceManager.FNRESOURCE_MEGAJOULES)/TimeWarp.fixedDeltaTime;
                double megajoules_ratio = megajoules_received / charged_power_received / 0.01;
                megajoules_ratio = (double.IsNaN(megajoules_ratio) || double.IsInfinity(megajoules_ratio)) ? 0 : megajoules_ratio;

                double atmo_thrust_factor = Math.Min(1.0,Math.Max(1.0 - Math.Pow(vessel.atmDensity,0.2),0));

                double exchanger_thrust_divisor = 1;
                if (radius > _attached_reactor.getRadius())
                {
                    exchanger_thrust_divisor = _attached_reactor.getRadius() * _attached_reactor.getRadius() / radius / radius;
                } else
                {
                    exchanger_thrust_divisor = radius * radius / _attached_reactor.getRadius() / _attached_reactor.getRadius();
                }

                double engineMaxThrust = 0.000000001;
                float power_ratio;
                if (max_power > 0)
                {
                    power_ratio = (float)(charged_power_received / max_power);
                    engineMaxThrust = Math.Max(2000.0 * charged_power_received*megajoules_ratio*atmo_thrust_factor*exchanger_thrust_divisor / isp / GameConstants.STANDARD_GRAVITY / _attached_engine.currentThrottle, 0.000000001);
                }

                if (!double.IsInfinity(engineMaxThrust) && !double.IsNaN(engineMaxThrust))
                {
                    _attached_engine.maxThrust = (float)engineMaxThrust;
                } else
                {
                    _attached_engine.maxThrust = 0.000000001f;
                }
            } else if (_attached_engine != null)
            {
                _attached_engine.maxThrust = 0.000000001f;
            }
		}
开发者ID:Ninja5tyl3,项目名称:KSPInterstellar,代码行数:50,代码来源:InterstellarMagneticNozzleControllerFX.cs

示例10: OnStart

        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);
            engine = part.GetComponent<ModuleEnginesFX>();

            Propellant fuelPropellant = new Propellant();
            foreach (Propellant prop in engine.propellants)
            {

                if (prop.name != "ElectricCharge")
                    fuelPropellant = prop;
            }

            ThrustCurve = new FloatCurve();
            ThrustCurve.Add(0f, engine.maxThrust);
            ThrustCurve.Add(minPressure, minThrust);

            AtmoCurve = new FloatCurve();
            AtmoCurve.Add(0f, engine.atmosphereCurve.Evaluate(0f));

            float rate = FindFlowRate (engine.maxThrust,engine.atmosphereCurve.Evaluate(0f),fuelPropellant);

            AtmoCurve.Add(1f,FindIsp(minThrust,rate,fuelPropellant));
        }
开发者ID:ChrisAdderley,项目名称:near-future,代码行数:24,代码来源:ElectricEngineThrustLimiter.cs

示例11: FixedUpdate

		public void FixedUpdate() 
        {
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (!active)
                {
                    base.OnFixedUpdate();
                }

                if (solarPanel != null)
                {
                    double inv_square_mult = Math.Pow(Vector3d.Distance(FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBIN].transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2) / Math.Pow(Vector3d.Distance(vessel.transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2);
                    FloatCurve satcurve = new FloatCurve();
                    satcurve.Add(0.0f, (float)inv_square_mult);
                    solarPanel.powerCurve = satcurve;

                    float solar_rate = solarPanel.flowRate * TimeWarp.fixedDeltaTime;
                    float clamper = PluginHelper.IsSolarPanelHeatingClamped 
                        ? (float)Math.Min(Math.Max((Math.Sqrt(inv_square_mult) - 1.5), 0.0), 1.0) 
                        : 1.0f;
                    float heat_rate =  clamper * solar_rate * 0.5f / 1000.0f;

                    if (getResourceBarRatio(FNResourceManager.FNRESOURCE_WASTEHEAT) >= 0.98 && solarPanel.panelState == ModuleDeployableSolarPanel.panelStates.EXTENDED && solarPanel.sunTracking)
                    {
                        solarPanel.Retract();
                        if (FlightGlobals.ActiveVessel == vessel)
                            ScreenMessages.PostScreenMessage("Warning Dangerous Overheating Detected: Solar Panel retraction occuring NOW!", 5.0f, ScreenMessageStyle.UPPER_CENTER);

                        return;
                    }

                    List<PartResource> prl = part.GetConnectedResources("ElectricCharge").ToList();
                    double current_charge = prl.Sum(pr => pr.amount);
                    double max_charge = prl.Sum(pr => pr.maxAmount);

                    var solar_supply = current_charge >= max_charge ? solar_rate / 1000.0f : 0;
                    var solar_maxSupply = solar_rate / 1000.0f;

                    supplyFNResourceFixedMax(solar_supply, solar_maxSupply, FNResourceManager.FNRESOURCE_MEGAJOULES);
                    wasteheat_production_f = supplyFNResource(heat_rate, FNResourceManager.FNRESOURCE_WASTEHEAT) / TimeWarp.fixedDeltaTime * 1000.0f;
                }
            }
		}
开发者ID:Yitscar,项目名称:KSPInterstellar,代码行数:43,代码来源:FNSolarPanelWasteHeatModule.cs

示例12: OnFixedUpdate

		public override void OnFixedUpdate() {
			base.OnFixedUpdate ();
			if (solarPanel != null) {
				float solar_rate = solarPanel.flowRate*TimeWarp.fixedDeltaTime;
				float heat_rate = solar_rate * 0.5f/1000.0f;

                double inv_square_mult = Math.Pow(Vector3d.Distance(FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBIN].transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2) / Math.Pow(Vector3d.Distance(vessel.transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2);
                FloatCurve satcurve = new FloatCurve();
                satcurve.Add(0.0f, (float)inv_square_mult);
                solarPanel.powerCurve = satcurve;

				if (getResourceBarRatio (FNResourceManager.FNRESOURCE_WASTEHEAT) >= 0.98 && solarPanel.panelState == ModuleDeployableSolarPanel.panelStates.EXTENDED && solarPanel.sunTracking) {
					solarPanel.Retract ();
					if (FlightGlobals.ActiveVessel == vessel) {
						ScreenMessages.PostScreenMessage ("Warning Dangerous Overheating Detected: Solar Panel retraction occuring NOW!", 5.0f, ScreenMessageStyle.UPPER_CENTER);
					}
					return;
				}

				wasteheat_production_f = supplyFNResource(heat_rate,FNResourceManager.FNRESOURCE_WASTEHEAT)/TimeWarp.fixedDeltaTime*1000.0f;
			}


		}
开发者ID:BobPalmer,项目名称:KSPInterstellar,代码行数:24,代码来源:FNSolarPanelWasteHeatModule.cs

示例13: GenerateCrossFlowDragCurve

        private void GenerateCrossFlowDragCurve()
        {
            crossFlowDragMachCurve = new FloatCurve();
            crossFlowDragMachCurve.Add(0, 1.2f, 0, 0);
            crossFlowDragMachCurve.Add(0.3f, 1.2f, 0, 0);
            crossFlowDragMachCurve.Add(0.7f, 1.5f, 0, 0);
            crossFlowDragMachCurve.Add(0.85f, 1.41f, 0, 0);
            crossFlowDragMachCurve.Add(0.95f, 2.1f, 0, 0);
            crossFlowDragMachCurve.Add(1f, 2f, -2f, -2f);
            crossFlowDragMachCurve.Add(1.3f, 1.6f, -0.5f, -0.5f);
            crossFlowDragMachCurve.Add(2f, 1.4f, -0.1f, -0.1f);
            crossFlowDragMachCurve.Add(5f, 1.25f, -0.02f, -0.02f);
            crossFlowDragMachCurve.Add(10f, 1.2f, 0, 0);

            crossFlowDragReynoldsCurve = new FloatCurve();
            crossFlowDragReynoldsCurve.Add(10000, 1f, 0, 0);
            crossFlowDragReynoldsCurve.Add(100000, 1.0083333333333333333333333333333f, 0, 0);
            crossFlowDragReynoldsCurve.Add(180000, 1.0083333333333333333333333333333f, 0, 0);
            crossFlowDragReynoldsCurve.Add(250000, 0.66666666666666666666666666666667f);
            crossFlowDragReynoldsCurve.Add(300000, 0.25f, -5E-07f, -5E-07f);
            crossFlowDragReynoldsCurve.Add(500000, 0.20833333333333333333333333333333f, 0, 0);
            crossFlowDragReynoldsCurve.Add(1000000, 0.33333333333333333333333333333333f, 7E-8f, 7E-8f);
            crossFlowDragReynoldsCurve.Add(10000000, 0.58333333333333333333333333333333f, 0, 0);
        }
开发者ID:ArthurFDU,项目名称:Ferram-Aerospace-Research,代码行数:24,代码来源:FARAeroSection.cs

示例14: SetInitialValueOfField

        public void SetInitialValueOfField(string targetField)
        {
            object obj = null;
            FieldInfo fi = GetFieldInfo(targetField, out obj);
            if (obj != null)
            {
                if (fi.FieldType.Equals(typeof(Single)) || fi.FieldType.Equals(typeof(Double)) || fi.FieldType.Equals(typeof(Int32)) || fi.FieldType.Equals(typeof(UInt32)))
                {
                    Debug.Log("Field type is: " + fi.FieldType.Name);
                    if (m_startState == PartModule.StartState.Editor)
                    {
                        TweakableParamGUI.GetInstance().CheckClear();
                        TweakableParamGUIItem item = new TweakableParamGUIItem(TweakableParamGUI.GetInstance(), this);
                        if (tweakedValue == -1.0f)
                        {
                            tweakedValue = Convert.ToSingle(fi.GetValue(obj));
                            Debug.Log("Field is: " + tweakedValue.ToString());
                        }

                        if (this.parentModule != null)
                        {
                            this.parentModule.UpdateTweakedValue(this);
                        }
                    }
                    else
                    {
                        TweakableParamGUI.GetInstance().ClearGUIItem();

                        if (tweakedValue > maxValue) tweakedValue = maxValue;
                        if (tweakedValue < minValue) tweakedValue = minValue;
                        Debug.Log(String.Format("Setting tweakable parameter: {0} to {1}", fi.Name, tweakedValue));
                        if (!setOnlyOnLaunchPad || ((int)m_startState & (int)(PartModule.StartState.PreLaunch)) != 0)
                            fi.SetValue(obj, Convert.ChangeType(tweakedValue, fi.FieldType));
                    }
                }
                else
                {
                    // Float curve.
                    Debug.Log("Field type is: " + fi.FieldType.Name);
                    if (m_startState == PartModule.StartState.Editor)
                    {
                        TweakableParamGUI.GetInstance().CheckClear();
                        TweakableParamGUIItem item = new TweakableParamGUIItem(TweakableParamGUI.GetInstance(), this);
                        if (tweakedCurve == null)
                        {
                            Debug.Log("Starting analyzing FloatCurve.");
                            tweakedCurve = GetKeysFromFloatCurve((FloatCurve)fi.GetValue(obj));
                        }

                        if (this.parentModule != null)
                        {
                            this.parentModule.UpdateTweakedValue(this);
                        }
                    }
                    else
                    {
                        TweakableParamGUI.GetInstance().ClearGUIItem();

                        Debug.Log(String.Format("Setting tweakable parameter: {0} to {1}", fi.Name, tweakedCurve));
                        if (!setOnlyOnLaunchPad || ((int)m_startState & (int)(PartModule.StartState.PreLaunch)) != 0)
                        {
                            if (tweakedCurve == null)
                            {
                                fi.SetValue(obj, Convert.ChangeType(tweakedValue, fi.FieldType));
                            }
                            else
                            {
                                FloatCurve newFloatCurve = new FloatCurve();
                                for (int i = 0; i < tweakedCurve.Count / 2; ++i)
                                    newFloatCurve.Add(tweakedCurve[i * 2], tweakedCurve[i * 2 + 1]);

                                fi.SetValue(obj, newFloatCurve);
                            }
                        }
                    }
                }
            }
        }
开发者ID:HoneyFox,项目名称:TweakableParam,代码行数:78,代码来源:TweakableSubParam.cs

示例15: InitializeOverallEngineData

        public void InitializeOverallEngineData(
            double nMinFlow, 
            double nMaxFlow, 
            FloatCurve nAtmosphereCurve, 
            FloatCurve nAtmCurve, 
            FloatCurve nVelCurve,
            double nThrottleResponseRate,
            double nChamberNominalTemp,
            double nMachLimit,
            double nMachMult,
            double nFlowMultMin,
            double nFlowMultCap,
            double nFlowMultSharp,
            bool nMultFlow,
            double nVaryThrust,
            float nSeed)
        {
            minFlow = nMinFlow * 1000d; // to kg
            maxFlow = nMaxFlow * 1000d;
            atmosphereCurve = nAtmosphereCurve;
            atmCurve = nAtmCurve;
            velCurve = nVelCurve;
            throttleResponseRate = nThrottleResponseRate;
            chamberTemp = 288d;
            chamberNominalTemp = nChamberNominalTemp;
            chamberNominalTemp_recip = 1d / chamberNominalTemp;
            machLimit = nMachLimit;
            machMult = nMachMult;
            flowMultMin = nFlowMultMin;
            flowMultCap = nFlowMultCap;
            flowMultCapSharpness = nFlowMultSharp;
            multFlow = nMultFlow;
            varyThrust = nVaryThrust;
            seed = nSeed;

            // falloff at > sea level pressure.
            if (atmosphereCurve.Curve.keys.Length == 2 && atmosphereCurve.Curve.keys[0].value != atmosphereCurve.Curve.keys[1].value)
            {
                Keyframe k0 = atmosphereCurve.Curve.keys[0];
                Keyframe k1 = atmosphereCurve.Curve.keys[1];
                if(k0.time > k1.time)
                {
                    Keyframe t = k0;
                    k0 = k1;
                    k1 = t;
                }
                float minIsp = 0.0001f;
                float invSlope = (k1.time - k0.time) / (k0.value - k1.value);
                float maxP = k1.time + (k1.value - minIsp) * invSlope;

                atmosphereCurve = new FloatCurve();
                atmosphereCurve.Add(k0.time, k0.value, k0.inTangent, k0.outTangent);
                atmosphereCurve.Add(k1.time, k1.value, k1.inTangent, k1.outTangent);
                atmosphereCurve.Add(maxP, minIsp);
            }
        }
开发者ID:Saabstory88,项目名称:ModularFuelSystem,代码行数:56,代码来源:SolverRF.cs


注:本文中的FloatCurve.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。