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


C# Vessel.GetReferenceTransformPart方法代码示例

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


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

示例1: InferDockingNode

        /// <summary>
        /// Infers the docking node this vessel controls
        /// </summary>
        /// <param name="vessel"></param>
        /// <returns></returns>
        private static ModuleDockingNode InferDockingNode(Vessel vessel)
        {
            RPMVesselComputer comp = RPMVesselComputer.Instance(vessel);
            Part compPart = comp.ReferencePart;
            uint launchId;
            if (compPart == null)
            {
                launchId = 0u;
            }
            else
            {
                launchId = compPart.launchID;
            }

            Part referencePart = vessel.GetReferenceTransformPart();
            ModuleDockingNode node = referencePart.FindModuleImplementing<ModuleDockingNode>();
            if (node != null)
            {
                //JUtil.LogMessage(vessel, "InferDockingNode: using reference part {0}", referencePart.name);
                // The current reference part is a docking node.
                return node;
            }

            for (int i = 0; i < vessel.parts.Count; ++i)
            {
                if (vessel.parts[i].launchID == launchId)
                {
                    node = vessel.parts[i].FindModuleImplementing<ModuleDockingNode>();
                    if (node != null)
                    {
                        //JUtil.LogMessage(vessel, "InferDockingNode: found a node on {0}", vessel.parts[i].name);
                        return node;
                    }
                }
            }

            // We did not find a docking node.
            return null;
        }
开发者ID:SarahLJP,项目名称:RasterPropMonitor,代码行数:44,代码来源:JSIInternalRPMButtons.cs

示例2: OnVesselChange

        private void OnVesselChange(Vessel vessel)
        {
            Log.Trace("Entering PlaneMode.OnVesselChange()");
            Log.Debug("Vessel has changed");

            if (vessel != null)
            {
                Log.Debug("new vessel is not null, triggering OnReferenceTransfomPartChange event");
                OnReferenceTransfomPartChange(vessel.GetReferenceTransformPart());
            }
            else
            {
                Log.Debug("new vessel is null, triggering OnReferenceTransfomPartChange event");
                OnReferenceTransfomPartChange(null);
            }

            Log.Debug("Updating _currentVessel");
            _currentVessel = vessel;

            Log.Trace("Leaving PlaneMode.OnVesselChange()");
        }
开发者ID:Kerbas-ad-astra,项目名称:PlaneMode,代码行数:21,代码来源:PlaneMode.cs


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