本文整理汇总了C#中Part.Couple方法的典型用法代码示例。如果您正苦于以下问题:C# Part.Couple方法的具体用法?C# Part.Couple怎么用?C# Part.Couple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.Couple方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CouplePart
public static void CouplePart(Part srcPart, Part tgtPart, string srcAttachNodeID = null, AttachNode tgtAttachNode = null)
{
// Node links
if (srcAttachNodeID != null)
{
if (srcAttachNodeID == "srfAttach")
{
KIS_Shared.DebugLog("Attach type : " + srcPart.srfAttachNode.nodeType + " | ID : " + srcPart.srfAttachNode.id);
srcPart.attachMode = AttachModes.SRF_ATTACH;
srcPart.srfAttachNode.attachedPart = tgtPart;
}
else
{
AttachNode srcAttachNode = srcPart.findAttachNode(srcAttachNodeID);
if (srcAttachNode != null)
{
KIS_Shared.DebugLog("Attach type : " + srcPart.srfAttachNode.nodeType + " | ID : " + srcAttachNode.id);
srcPart.attachMode = AttachModes.STACK;
srcAttachNode.attachedPart = tgtPart;
if (tgtAttachNode != null)
{
tgtAttachNode.attachedPart = srcPart;
}
}
else
{
KIS_Shared.DebugError("Source attach node not found !");
}
}
}
else
{
KIS_Shared.DebugWarning("Missing source attach node !");
}
srcPart.Couple(tgtPart);
}
示例2: WaitAndAttach
private IEnumerator WaitAndAttach(Part partToAttach, Vector3 position, Quaternion rotation, Part toPart = null)
{
while (!partToAttach.rigidbody)
{
KAS_Shared.DebugLog("WaitAndAttach(Pointer) - Waiting rigidbody to initialize...");
yield return new WaitForFixedUpdate();
}
KASModuleGrab moduleGrab = partToAttach.GetComponent<KASModuleGrab>();
if (toPart)
{
KAS_Shared.DebugLog("WaitAndAttach(Pointer) - Rigidbody initialized, setting velocity...");
partToAttach.rigidbody.velocity = toPart.rigidbody.velocity;
partToAttach.rigidbody.angularVelocity = toPart.rigidbody.angularVelocity;
KAS_Shared.DebugLog("WaitAndAttach(Pointer) - Waiting velocity to apply by waiting 0.1 seconds...");
yield return new WaitForSeconds(0.1f);
partToAttach.transform.position = position;
partToAttach.transform.rotation = rotation;
partToAttach.Couple(toPart);
if (moduleGrab)
{
moduleGrab.fxSndAttachPart.audio.Play();
}
else
{
KAS_Shared.DebugWarning("UpdatePointer(Pointer) No grab module found, cannot fire sound");
}
}
else
{
partToAttach.transform.position = position;
partToAttach.transform.rotation = rotation;
if (moduleGrab)
{
moduleGrab.AttachStatic();
moduleGrab.fxSndAttachStatic.audio.Play();
}
else
{
KAS_Shared.DebugWarning("UpdatePointer(Pointer) No grab module found, part cannot be attached on static");
}
}
KAS_Shared.ResetCollisionEnhancer(partToAttach);
}
示例3: CoupleWithCraft
private void CoupleWithCraft ()
{
craftRoot = craftVessel.rootPart;
vesselInfo = new DockedVesselInfo ();
vesselInfo.name = craftVessel.vesselName;
vesselInfo.vesselType = craftVessel.vesselType;
vesselInfo.rootPartUId = craftRoot.flightID;
craftRoot.Couple (builder.part);
if (builder.vessel != FlightGlobals.ActiveVessel) {
FlightGlobals.ForceSetActiveVessel (builder.vessel);
}
}
示例4: WaitAndCouple
IEnumerator WaitAndCouple (Part part)
{
yield return null;
part.Couple (recycler.part);
fsm.RunEvent (event_enter_field);
}