本文整理汇总了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;
}
示例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()");
}