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


C# Vessel.IsEvaKerbal方法代码示例

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


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

示例1: CalculateVesselHeight

 /// <summary>
 /// This method calculates the height in meters from the ship's "current point" to its lowest
 /// extent. Subtracting this number from vessel.altitude gives the altitude of the bottom
 /// of the ship, in the ship's current orientation.
 /// 
 /// Thank you to SirDiazo's mod Landing Height for code that inspired this section.
 /// Landing Height: https://kerbalstuff.com/mod/458/Landing%20Height
 /// 
 /// It's notable that this code is somewhat simplified from SirDiazo's because it's solving
 /// a simpler problem (i.e. it's saving computation by giving more of an approximation).
 /// 
 /// This is a moderately expensive calculation to perform, so use sparingly (i.e. not on
 /// every frame).
 /// </summary>
 /// <returns></returns>
 private static double CalculateVesselHeight(Vessel vessel, out Part lowestPart)
 {
     lowestPart = null;
     if (IsTimeWarp) return 0.0; // vessel is packed, can't do anything
     if (vessel.IsEvaKerbal()) return 0.0; // we don't do this for kerbals
     List<Part> parts = ChooseParts(vessel);
     double minPartPosition = double.PositiveInfinity;
     for (int partIndex = 0; partIndex < parts.Count; ++partIndex)
     {
         Part part = parts[partIndex];
         if (!part.collider.enabled) continue;
         double partPosition = Vector3.Distance(
             part.collider.ClosestPointOnBounds(vessel.mainBody.position),
             vessel.mainBody.position);
         if (partPosition < minPartPosition)
         {
             minPartPosition = partPosition;
             lowestPart = part;
         }
     }
     if (lowestPart == null) return 0.0; // no usable parts
     double vesselPosition = Vector3.Distance(
         //vessel.GetReferenceTransformPart().transform.position,
         vessel.transform.position,
         vessel.mainBody.position);
     return vesselPosition - minPartPosition;
 }
开发者ID:Kerbas-ad-astra,项目名称:BetterBurnTime,代码行数:42,代码来源:ImpactTracker.cs


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