本文整理汇总了C#中Part.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Part.SendMessage方法的具体用法?C# Part.SendMessage怎么用?C# Part.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.SendMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendKISMessage
public static void SendKISMessage(Part destPart, MessageAction action, Part tgtPart = null, AttachNode tgtNode = null)
{
BaseEventData bEventData = new BaseEventData(BaseEventData.Sender.AUTO);
bEventData.Set("action", action.ToString());
bEventData.Set("targetPart", tgtPart);
bEventData.Set("targetNode", tgtNode);
destPart.SendMessage("OnKISAction", bEventData, SendMessageOptions.DontRequireReceiver);
}
示例2: WaitAndSendMsg
private IEnumerator WaitAndSendMsg(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();
}
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.SendMessage("OnAttachPart", toPart, SendMessageOptions.DontRequireReceiver);
}
else
{
partToAttach.transform.position = position;
partToAttach.transform.rotation = rotation;
partToAttach.SendMessage("OnAttachStatic", SendMessageOptions.DontRequireReceiver);
}
}
示例3: onPartGeometryUpdate
public static void onPartGeometryUpdate(Part part, bool createDefaultCube)
{
if (isFARInstalled())
{
part.SendMessage("GeometryPartModuleRebuildMeshData");
}
else if (createDefaultCube && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
{
DragCube newDefaultCube =DragCubeSystem.Instance.RenderProceduralDragCube(part);
newDefaultCube.Weight = 1f;
newDefaultCube.Name = "Default";
part.DragCubes.ClearCubes();
part.DragCubes.Cubes.Add(newDefaultCube);
part.DragCubes.ResetCubeWeights();
}
}
示例4: onPartGeometryUpdate
/// <summary>
/// Updates part highlight renderer list, sends message to SSTUFlagDecal to update its renderer,
/// sends message to FAR to update voxels, or if createDefaultCube==true will re-render the 'default' stock drag cube for the part<para/>
/// Should be called anytime the model geometry in a part is changed -- either models added/deleted, procedural meshes updated. Other methods exist for pure drag-cube updating in SSTUStockInterop.
/// </summary>
/// <param name="part"></param>
/// <param name="createDefaultCube"></param>
public static void onPartGeometryUpdate(Part part, bool createDefaultCube)
{
if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; }//noop on prefabs
//MonoBehaviour.print(System.Environment.StackTrace);
SSTUStockInterop.updatePartHighlighting(part);
part.airlock = locateAirlock(part);
part.SendMessage("onPartGeometryChanged", part);//used by SSTUFlagDecal and potentially others in the future
if (isFARInstalled())
{
//FARdebug(part);
part.SendMessage("GeometryPartModuleRebuildMeshData");
}
else if (createDefaultCube && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
{
SSTUStockInterop.addDragUpdatePart(part);
}
}