コード例 #1
0
ファイル: ModuleROTank.cs プロジェクト: RCrockford/ROLibrary
        /// <summary>
        /// Update the attach nodes for the current model-module configuration.
        /// The 'nose' module is responsible for updating of upper attach nodes, while the 'mount' module is responsible for lower attach nodes.
        /// Also includes updating of 'interstage' nose/mount attach nodes.
        /// Also includes updating of surface-attach node position.
        /// Also includes updating of any parts that are surface attached to this part.
        /// </summary>
        /// <param name="userInput"></param>
        public void updateAttachNodes(bool userInput)
        {
            //update the standard top and bottom attach nodes, using the node position(s) defined in the nose and mount modules
            noseModule.updateAttachNodeTop("top", userInput);
            mountModule.updateAttachNodeBottom("bottom", userInput);

            //update the model-module specific attach nodes, using the per-module node definitions from the part
            noseModule.updateAttachNodeBody(noseNodeNames, userInput);
            coreModule.updateAttachNodeBody(coreNodeNames, userInput);
            mountModule.updateAttachNodeBody(mountNodeNames, userInput);

            // Update the Nose Interstage Node
            float   y        = noseModule.modulePosition + noseModule.moduleVerticalScale;
            int     nodeSize = Mathf.RoundToInt(coreModule.moduleDiameter) + 1;
            Vector3 pos      = new Vector3(0, y, 0);

            ROLSelectableNodes.updateNodePosition(part, noseInterstageNode, pos);
            AttachNode noseInterstage = part.FindAttachNode(noseInterstageNode);

            if (noseInterstage != null)
            {
                ROLAttachNodeUtils.updateAttachNodePosition(part, noseInterstage, pos, Vector3.up, userInput, nodeSize);
            }

            // Update the Mount Interstage Node
            y        = mountModule.modulePosition + mountModule.moduleVerticalScale;
            nodeSize = Mathf.RoundToInt(coreModule.moduleDiameter) + 1;
            pos      = new Vector3(0, y, 0);
            ROLSelectableNodes.updateNodePosition(part, mountInterstageNode, pos);
            AttachNode mountInterstage = part.FindAttachNode(mountInterstageNode);

            if (mountInterstage != null)
            {
                ROLAttachNodeUtils.updateAttachNodePosition(part, mountInterstage, pos, Vector3.down, userInput, nodeSize);
            }


            //update surface attach node position, part position, and any surface attached children
            AttachNode surfaceNode = part.srfAttachNode;

            if (surfaceNode != null)
            {
                coreModule.updateSurfaceAttachNode(surfaceNode, prevDiameter, userInput);
            }
        }
コード例 #2
0
 private void UpdateAttachNodes(bool userInput)
 {
     coreModule.updateAttachNodeBody(coreNodeNames, userInput);
     coreModule.updateSurfaceAttachNode(part.srfAttachNode, panelLength, panelWidth, userInput);
 }