當前位置: 首頁>>代碼示例>>C#>>正文


C# AttachNode類代碼示例

本文整理匯總了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;
             }
         }
     }
 }
開發者ID:Kerbas-ad-astra,項目名稱:SSTULabs,代碼行數:25,代碼來源:SSTUCrossfeedDisabler.cs

示例2: AnimatedNode

 public AnimatedNode(AttachNode node, Transform node_transform, Part part)
 {
     this.node = node;
     this.part = part;
     nT        = node_transform;
     pT        = part.partTransform;
 }
開發者ID:kevin-ye,項目名稱:hangar,代碼行數:7,代碼來源:AnimatedNode.cs

示例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();
                }
            }
        }
開發者ID:Kerbas-ad-astra,項目名稱:NearFutureElectrical,代碼行數:32,代碼來源:NodeTriggeredMesh.cs

示例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;
            }
        }
開發者ID:Amorymeltzer,項目名稱:KIS,代碼行數:35,代碼來源:KIS_Shared.cs

示例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;
        }
開發者ID:d5039m,項目名稱:KerbalEngineer,代碼行數:10,代碼來源:AttachNodeSim.cs

示例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;
 }
開發者ID:vosechu,項目名稱:ProceduralParts,代碼行數:10,代碼來源:ProceduralHeatshield.cs

示例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);
     }
 }
開發者ID:Joshg213,項目名稱:SSTULabs,代碼行數:15,代碼來源:SSTUAttachNodeUtils.cs

示例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();
            }
        }
開發者ID:N3h3miah,項目名稱:OrbitalMaterialScience,代碼行數:11,代碼來源:KEES_PEC.cs

示例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);
     }
 }
開發者ID:shadowmage45,項目名稱:SSTULabs,代碼行數:16,代碼來源:SSTUAttachNodeUtils.cs

示例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;
 }
開發者ID:Joshg213,項目名稱:SSTULabs,代碼行數:21,代碼來源:SSTUAttachNodeUtils.cs

示例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();
 }
開發者ID:kevin-ye,項目名稱:hangar,代碼行數:12,代碼來源:AnimatedNode.cs

示例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;
        }
開發者ID:JulioDragonFist,項目名稱:ProceduralParts,代碼行數:14,代碼來源:DecouplerTweaker.cs

示例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");
     }
 }
開發者ID:ErzengelLichtes,項目名稱:KAS,代碼行數:17,代碼來源:KAS_Shared.cs

示例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");
            }
        }
開發者ID:Kerbas-ad-astra,項目名稱:KAS,代碼行數:21,代碼來源:KAS_Shared.cs

示例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");
                    }
                }
            }
        }
開發者ID:Kerbas-ad-astra,項目名稱:SSTULabs,代碼行數:39,代碼來源:SSTUCrossfeedDisabler.cs


注:本文中的AttachNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。