• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AttachNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AttachNode的典型用法代码示例。如果您正苦于以下问题:C# AttachNode类的具体用法?C# AttachNode怎么用?C# AttachNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AttachNode类属于命名空间,在下文中一共展示了AttachNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: 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);
        }
开发者ID:Amorymeltzer,项目名称:KIS,代码行数:37,代码来源:KIS_Shared.cs


示例17: 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);
 }
开发者ID:Amorymeltzer,项目名称:KIS,代码行数:8,代码来源:KIS_Shared.cs


示例18: decoupleNode

 private void decoupleNode(AttachNode node)
 {
     Part attachedPart = node.attachedPart;
     if(attachedPart==null){return;}
     if (attachedPart == part.parent)
     {
         part.decouple (0f);
     }
     else
     {
         attachedPart.decouple (0f);
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:SSTULabs,代码行数:13,代码来源:SSTUInterstageFairing.cs


示例19: OnStart

        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart (state);
            upperNode = part.findAttachNode(topNodeName);
            lowerNode = part.findAttachNode(bottomNodeName);
            innerNode = part.findAttachNode(internalNodeName);

            modelBase = part.FindModelTransform(modelMeshName);
            SSTUUtils.enableRenderRecursive(modelBase, false);
            SSTUUtils.enableColliderRecursive(modelBase, false);

            if(boundsCollider!=null)
            {
                Component.Destroy(boundsCollider);
                boundsCollider = null;
            }

            restoreEditorFields();
            updateModelParameters();

            updateFairingHeight(currentHeight);//set nodes to current height, will not change any positions parts with a zero delta, but will still set nodes to proper height

            if(HighLogic.LoadedSceneIsFlight)//if in flight, selectively enable/disable the actions/gui events
            {
                Events ["deployEvent"].active = !deployed && !decoupled;//only available if not previously deployed or decoupled
                Events ["decoupleEvent"].active = deployed && !decoupled;//only available if deployed but not decoupled
                Actions ["deployAction"].active = !deployed && !decoupled;//only available if not previously deployed or decoupled
                Actions ["decoupleAction"].active = deployed && !decoupled;//only available if deployed but not decoupled
                enableEditorColliders(false);
            }

            //register for game events, used to notify when to update shielded parts
            GameEvents.onEditorShipModified.Add(new EventData<ShipConstruct>.OnEvent(onEditorVesselModified));
            GameEvents.onVesselWasModified.Add(new EventData<Vessel>.OnEvent(onVesselModified));
            GameEvents.onVesselGoOffRails.Add(new EventData<Vessel>.OnEvent(onVesselUnpack));
            GameEvents.onVesselGoOnRails.Add(new EventData<Vessel>.OnEvent(onVesselPack));
            GameEvents.onPartDie.Add(new EventData<Part>.OnEvent(onPartDestroyed));
        }
开发者ID:Kerbas-ad-astra,项目名称:SSTULabs,代码行数:38,代码来源:SSTUInterstageFairing.cs


示例20: _getNodeName

 private string _getNodeName(AttachNode node)
 {
     if (this._nodeNameMapping.ContainsKey(node))
     {
         return this._nodeNameMapping[node];
     }
     return "n.a.";
 }
开发者ID:Kerbas-ad-astra,项目名称:NodeHelper,代码行数:8,代码来源:NodeHelper.cs



注:本文中的AttachNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Attachment类代码示例发布时间:2022-05-24
下一篇:
C# AtomicUndoOperation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap