当前位置: 首页>>代码示例>>C#>>正文


C# Transform.NestToParent方法代码示例

本文整理汇总了C#中UnityEngine.Transform.NestToParent方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.NestToParent方法的具体用法?C# Transform.NestToParent怎么用?C# Transform.NestToParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Transform的用法示例。


在下文中一共展示了Transform.NestToParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: restoreModels

        /// <summary>
        /// Restore the currently selected modules' models, and restore their current texture-set selection
        /// Removes any existing models from special-named root transforms with no attempt at re-use
        /// </summary>
        private void restoreModels()
        {
            topDockModule.setupModel(getTopDockRoot(true), ModelOrientation.TOP);
            topModule.setupModel(getTopRoot(true), ModelOrientation.TOP);
            coreModule.setupModel(getCoreRoot(false), ModelOrientation.CENTRAL, true);//setup model on prefab part and don't touch it after that
            bottomModule.setupModel(getBottomRoot(true), ModelOrientation.BOTTOM);
            bottomDockModule.setupModel(getBottomDockRoot(true), ModelOrientation.BOTTOM);
            solarModule.enable(getSolarRoot(true), 0);

            topModule.enableTextureSet(currentTopTexture);
            coreModule.enableTextureSet(currentCoreTexture);
            bottomModule.enableTextureSet(currentBottomTexture);

            //control transforms need to exist during part initialization
            //else things will explode if one of those transforms is the reference transform when a vessel is reloaded
            //so create them on prefab and restore on other instances
            if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight)
            {
                Transform modelRoot = part.transform.FindRecursive("model");

                topDockTransform = new GameObject(topDockName).transform;
                topDockTransform.NestToParent(modelRoot);
                topDockTransform.Rotate(-90, 0, 0, Space.Self);
                topControlTransform = new GameObject(topDockName + "Control").transform;
                topControlTransform.NestToParent(modelRoot);

                bottomDockTransform = new GameObject(bottomDockName).transform;
                bottomDockTransform.NestToParent(modelRoot);
                bottomDockTransform.Rotate(90, 0, 0, Space.Self);
                bottomControlTransform = new GameObject(bottomDockName + "Control").transform;
                bottomControlTransform.NestToParent(modelRoot);
                bottomControlTransform.Rotate(180, 0, 0, Space.Self);
            }
            else
            {
                topDockTransform = part.transform.FindRecursive(topDockName);
                topControlTransform = part.transform.FindRecursive(topDockName + "Control");
                bottomDockTransform = part.transform.FindRecursive(bottomDockName);
                bottomControlTransform = part.transform.FindRecursive(bottomDockName + "Control");
            }
            SSTUStockInterop.updatePartHighlighting(part);
        }
开发者ID:shadowmage45,项目名称:SSTULabs,代码行数:46,代码来源:SSTUModularStationCore.cs

示例2: initializeModels

        /// <summary>
        /// create the models, and restore them to their saved/default state
        /// </summary>
        private void initializeModels()
        {
            Transform baseTransform = part.transform.FindRecursive("model").FindOrCreate(baseTransformName);
            baseTransform.NestToParent(part.transform.FindRecursive("model"));

            targetTransform = baseTransform.FindOrCreate(targetTransformName);
            targetTransform.NestToParent(baseTransform);
            targetTransform.rotation = Quaternion.LookRotation(part.transform.up, part.transform.forward);

            foreach (ParachuteModelData droge in drogueChuteModules) { droge.setupModel(part, baseTransform, targetTransform); }
            foreach (ParachuteModelData main in mainChuteModules) { main.setupModel(part, baseTransform, targetTransform); }
            hasDrogueChute = drogueChuteModules.Length > 0;
        }
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:16,代码来源:SSTUModularParachuteOld.cs


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