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


C# FloatCurve类代码示例

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


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

示例1: FixPressure

        void FixPressure(FloatCurve curve, double topLayer)
        {
            List<double[]> list = ReadCurve(curve); /* Avoid Bad Curves ==> */ if (list.Count < 2) { UnityEngine.Debug.Log("SigmaLog: This pressure curve has " + (list.Count == 0 ? "no keys" : "just one key") + ". I don't know what you expect me to do with that."); return; }

            double maxAltitude = list.Last()[0];

            bool smoothEnd = list.Last()[1] == 0 && list.Count > 2;
            double smoothRange = list.Last()[0] - list[list.Count - 2][0];
            if (smoothEnd) list.RemoveAt(list.Count - 1);

            if (topLayer > maxAltitude)
            {
                Extend(list, topLayer);
                maxAltitude = list.Last()[0];
            }

            if (topLayer < maxAltitude)
            {
                Trim(list, topLayer);
            }

            if (smoothEnd)
            {
                Smooth(list, smoothRange);
            }

            curve.Load(WriteCurve(list));
        }
开发者ID:Sigma88,项目名称:Sigma-Dimensions,代码行数:28,代码来源:AtmosphereTopLayer.cs

示例2: 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, .1f);
                DefaultLiftCurve.Add(8, .45f);
                DefaultLiftCurve.Add(19, 1);
                DefaultLiftCurve.Add(23, .9f);
                DefaultLiftCurve.Add(29, 0.85f);
                DefaultLiftCurve.Add(35, 0.65f);
                DefaultLiftCurve.Add(65, .6f);
                DefaultLiftCurve.Add(90, .7f);
            }

            if(DefaultDragCurve == null)
            {
                DefaultDragCurve = new FloatCurve();
                DefaultDragCurve.Add(0, 0.00225f);
                DefaultDragCurve.Add(5, .0035f);
                DefaultDragCurve.Add(15, .015f);
                DefaultDragCurve.Add(29, .025f);
                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:jediminer543,项目名称:BDArmory,代码行数:31,代码来源:MissileGuidance.cs

示例3: 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

示例4: HeatShieldType

 public HeatShieldType(ConfigNode node)
 {
     name = node.GetStringValue("name");
     heatCurve = node.GetFloatCurve("heatCurve");
     resourceMult = node.GetFloatValue("resourceMult", resourceMult);
     ablationMult = node.GetFloatValue("ablationMult", ablationMult);
     massMult = node.GetFloatValue("massMult", massMult);
 }
开发者ID:shadowmage45,项目名称:SSTULabs,代码行数:8,代码来源:SSTUModularHeatShield.cs

示例5: SSTUSolarPanelStatic

 public SSTUSolarPanelStatic()
 {
     //the default stock temperatureEfficiencyCurve
     this.temperatureEfficCurve = new FloatCurve ();
     this.temperatureEfficCurve.Add (4f, 1.2f, 0f, -0.0005725837f);
     this.temperatureEfficCurve.Add (300f, 1f, -0.0008277721f, -0.0008277721f);
     this.temperatureEfficCurve.Add (1200f, 0.1f, -0.0003626566f, -0.0003626566f);
     this.temperatureEfficCurve.Add (2500f, 0.01f, 0f, 0f);
 }
开发者ID:Kerbas-ad-astra,项目名称:SSTULabs,代码行数:9,代码来源:SSTUSolarPanelStatic.cs

示例6: Load

 public void Load(ConfigNode node)
 {
     if (node.HasValue("scope"))
         scope = node.GetValue("scope").ToLower();
     if (node.HasNode("reliabilityCurve"))
     {
         reliabilityCurve = new FloatCurve();
         reliabilityCurve.Load(node.GetNode("reliabilityCurve"));
     }
 }
开发者ID:Corax,项目名称:TestFlight,代码行数:10,代码来源:TestFlightReliability.cs

示例7: OnLoad

 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     if (node.HasNode("cycle"))
     {
         cycle = new FloatCurve();
         cycle.Load(node.GetNode("cycle"));
     }
     else
         cycle = null;
 }
开发者ID:Corax,项目名称:TestFlight,代码行数:11,代码来源:TestFlightReliability_EngineCycle.cs

示例8: 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

示例9: add

        internal void add(float time, Vector2 xy)
        {
            if (curveX == null) {
                curveX = new FloatCurve();
            }
            curveX.Add(time, xy.x);

            if (curveY == null) {
                curveY = new FloatCurve();
            }
            curveY.Add(time, xy.y);
        }
开发者ID:Kerbotanist,项目名称:ksp_toolbar,代码行数:12,代码来源:FloatCurveXY.cs

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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