本文整理汇总了C#中AttachNode类的典型用法代码示例。如果您正苦于以下问题:C# AttachNode类的具体用法?C# AttachNode怎么用?C# AttachNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttachNode类属于命名空间,在下文中一共展示了AttachNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setupNodeCrossfeed
private void setupNodeCrossfeed()
{
AttachNode node = part.findAttachNode(nodeName);
if(node!=null && node.attachedPart!=null)
{
Part ap = node.attachedPart;
AttachNode an = null;
if(ap.NoCrossFeedNodeKey==null || ap.NoCrossFeedNodeKey.Length==0)
{
foreach(AttachNode m in ap.attachNodes)
{
if(m.attachedPart==part)
{
an = m;
break;
}
}
if(an!=null)
{
ap.NoCrossFeedNodeKey = an.id;
otherNode = an;
}
}
}
}
示例2: AnimatedNode
public AnimatedNode(AttachNode node, Transform node_transform, Part part)
{
this.node = node;
this.part = part;
nT = node_transform;
pT = part.partTransform;
}
示例3: OnStart
public override void OnStart(PartModule.StartState state)
{
if (part != null)
{
if (MeshName != "")
{
meshObject = part.FindModelTransform(MeshName).gameObject;
}
if (NodeName != "")
{
foreach (AttachNode nodes in part.attachNodes)
{
if (nodes.id == NodeName)
node = nodes;
}
}
if (meshObject == null)
{
Utils.LogError("Couldn't find gameObject " + MeshName);
}
else if (node == null)
{
Utils.LogError("Couldn't find stack node " + NodeName);
}
else
{
SetVisibility();
}
}
}
示例4: AssignAttachIcon
public static void AssignAttachIcon(Part part, AttachNode node, Color iconColor, string name = null)
{
// Create NodeTransform if needed
if (node.nodeTransform == null)
{
node.nodeTransform = new GameObject("KISNodeTransf").transform;
node.nodeTransform.parent = part.transform;
node.nodeTransform.localPosition = node.position;
node.nodeTransform.localRotation = KIS_Shared.GetNodeRotation(node);
}
if (!node.icon)
{
node.icon = GameObject.CreatePrimitive(PrimitiveType.Sphere);
if (node.icon.collider) UnityEngine.Object.DestroyImmediate(node.icon.collider);
if (node.icon.renderer)
{
node.icon.renderer.material = new Material(Shader.Find("Transparent/Diffuse"));
iconColor.a = 0.5f;
node.icon.renderer.material.color = iconColor;
}
node.icon.transform.parent = part.transform;
if (name != null) node.icon.name = name;
double num;
if (node.size == 0)
{
num = (double)node.size + 0.5;
}
else num = (double)node.size;
node.icon.transform.localScale = Vector3.one * node.radius * (float)num;
node.icon.transform.parent = node.nodeTransform;
node.icon.transform.localPosition = Vector3.zero;
node.icon.transform.localRotation = Quaternion.identity;
}
}
示例5: New
public static AttachNodeSim New(PartSim partSim, String newId, AttachNode.NodeType newNodeType)
{
AttachNodeSim nodeSim = pool.Borrow();
nodeSim.attachedPartSim = partSim;
nodeSim.nodeType = newNodeType;
nodeSim.id = newId;
return nodeSim;
}
示例6: CopyNodeSizeAndStrength
private void CopyNodeSizeAndStrength()
{
if (bottomNode == null)
bottomNode = part.findAttachNode(bottomNodeId);
if (topNode == null)
topNode = part.findAttachNode(topNodeId);
bottomNode.size = topNode.size;
bottomNode.breakingForce = topNode.breakingForce;
bottomNode.breakingTorque = topNode.breakingTorque;
}
示例7: destroyAttachNode
/// <summary>
/// Destroys the input attach node and removes it from the part.
/// </summary>
/// <param name="part"></param>
/// <param name="node"></param>
public static void destroyAttachNode(Part part, AttachNode node)
{
if (node == null) { return; }
part.attachNodes.Remove(node);
node.owner = null;
if (node.icon != null)
{
GameObject.Destroy(node.icon);
}
}
示例8: OnStart
public override void OnStart(PartModule.StartState state)
{
base.OnStart(state);
node = part.findAttachNode(nodeName);
if (node == null)
{
NE_Helper.logError("KEES PEC: AttachNode not found");
node = part.attachNodes.First();
}
}
示例9: destroyAttachNode
/// <summary>
/// Destroys the input attach node and removes it from the part.
/// </summary>
/// <param name="part"></param>
/// <param name="node"></param>
public static void destroyAttachNode(Part part, AttachNode node)
{
if (node == null) { return; }
if (node.attachedPart != null) { MonoBehaviour.print("ERROR: Deleting attach node: " + node.id + " with attached part: " + node.attachedPart); }
part.attachNodes.Remove(node);
node.owner = null;
if (node.icon != null)
{
GameObject.Destroy(node.icon);
}
}
示例10: createAttachNode
/// <summary>
/// Creates a new attach node with the given paramaters and adds it to the input part.
/// </summary>
/// <param name="part"></param>
/// <param name="id"></param>
/// <param name="pos"></param>
/// <param name="orient"></param>
/// <param name="size"></param>
/// <returns></returns>
public static AttachNode createAttachNode(Part part, String id, Vector3 pos, Vector3 orient, int size)
{
AttachNode newNode = new AttachNode();
newNode.id = id;
newNode.owner = part;
newNode.nodeType = AttachNode.NodeType.Stack;
newNode.size = size;
newNode.originalPosition = newNode.position = pos;
newNode.originalOrientation = newNode.orientation = orient;
part.attachNodes.Add(newNode);
return newNode;
}
示例11: UpdateNode
public void UpdateNode()
{
//update node
node.size = 0; //force node size to be zero; otherwise the Kraken comes when inflating
node.position = pT.InverseTransformPoint(nT.position);
node.originalPosition = node.position;
//update attached parts
attached_part = node.attachedPart;
if(attached_part != null)
attached_node = attached_part.findAttachNodeByPart(part);
if(!UpdateJoint()) UpdatePartsPos();
}
示例12: ChangeAttachNodeSize
public void ChangeAttachNodeSize(AttachNode node, float minDia, float area)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (node.id != textureMessageName || maxImpulseDiameterRatio == 0)
return;
UI_FloatEdit ejectionImpulseEdit = (UI_FloatEdit)Fields["ejectionImpulse"].uiControlEditor;
float oldRatio = ejectionImpulse / ejectionImpulseEdit.maxValue;
maxImpulse = Mathf.Round(maxImpulseDiameterRatio * minDia);
ejectionImpulseEdit.maxValue = maxImpulse;
ejectionImpulse = Mathf.Round(maxImpulse * oldRatio / 0.1f) * 0.1f;
}
示例13: AddNodeTransform
public static void AddNodeTransform(Part p, AttachNode attachNode)
{
if (attachNode.nodeTransform == null)
{
Transform nodeTransform = new GameObject("KASNodeTransf").transform;
nodeTransform.parent = p.transform;
nodeTransform.localPosition = attachNode.position;
nodeTransform.rotation = KAS_Shared.DirectionToQuaternion(p.transform, attachNode.orientation);
attachNode.nodeTransform = nodeTransform;
}
else
{
attachNode.nodeTransform.localPosition = attachNode.position;
attachNode.nodeTransform.rotation = KAS_Shared.DirectionToQuaternion(p.transform, attachNode.orientation);
KAS_Shared.DebugLog("AddTransformToAttachNode - Node : " + attachNode.id + " already have a nodeTransform, only update");
}
}
示例14: AddNodeTransform
public static void AddNodeTransform(Part p, AttachNode attachNode)
{
Quaternion rotation = Quaternion.LookRotation(attachNode.orientation, Vector3.up);
if (attachNode.nodeType == AttachNode.NodeType.Surface) {
rotation = Quaternion.Inverse(rotation);
}
if (attachNode.nodeTransform == null) {
Transform nodeTransform = new GameObject("KASNodeTransf").transform;
nodeTransform.parent = p.transform;
nodeTransform.localPosition = attachNode.position;
nodeTransform.localRotation = rotation;
attachNode.nodeTransform = nodeTransform;
} else {
attachNode.nodeTransform.localPosition = attachNode.position;
attachNode.nodeTransform.localRotation = rotation;
KAS_Shared.DebugLog("AddTransformToAttachNode - Node : " + attachNode.id
+ " already have a nodeTransform, only update");
}
}
示例15: updatePartCrossflow
private void updatePartCrossflow()
{
print ("examining decoupler part crossfeed!");
if(otherNode!=null){otherNode.ResourceXFeed=otherNodeDefaultFlow;}
otherNode=null;
AttachNode node = part.findAttachNode(nodeName);
if(node!=null)
{
node.ResourceXFeed = !disableCrossflow;
Part otherPart = node.attachedPart;
AttachNode oNode = otherPart==null ? null : otherPart.findAttachNodeByPart(part);
print ("set decoupler node crossflow to: "+node.ResourceXFeed+ " for node: "+node.id+" for part: "+part+ " attached part: "+otherPart+ " oNode: "+oNode);
if(oNode!=null)
{
otherNode = oNode;
otherNodeDefaultFlow = oNode.ResourceXFeed;
if(disableCrossflow){oNode.ResourceXFeed=false;}
print ("set other node crossflow to: "+oNode.ResourceXFeed);
}
else if(otherPart!=null)
{
AttachNode on = SSTUUtils.findRemoteParentNode(otherPart, part);
if(on!=null)
{
print ("found remote node connection through: "+on+" :: "+on.id+" :: attached "+on.attachedPart);
otherNode = on;
otherNodeDefaultFlow = on.ResourceXFeed;
if(disableCrossflow){on.ResourceXFeed=false;}
print ("set remote connected node crosfeed to: "+on.ResourceXFeed);
}
else
{
print ("found part connected to node, but could not trace parantage through nodes");
}
}
}
}