コード例 #1
0
        public static SpringManager PerformSetup
        (
            GameObject rootObject,
            IEnumerable <GameObject> newSpringBones,
            AutoSetupParameters parameters
        )
        {
            SpringBoneSetup.DestroySpringManagersAndBones(rootObject);
            SpringColliderSetup.DestroySpringColliders(rootObject);

            var springBones = new List <SpringBone>();

            foreach (var boneParent in newSpringBones.Where(boneParent => boneParent.transform.childCount > 0))
            {
                springBones.Add(boneParent.AddComponent <SpringBone>());
            }

            var manager = rootObject.AddComponent <SpringManager>();

            SpringBoneSetup.FindAndAssignSpringBones(manager, true);

            if (parameters.createPivots)
            {
                foreach (var springBone in springBones)
                {
                    SpringBoneSetup.CreateSpringPivotNode(springBone);
                }
            }

            return(manager);
        }
コード例 #2
0
            public void BuildObjects(GameObject colliderRoot)
            {
                SpringColliderSetup.DestroySpringColliders(colliderRoot);
                var allChildren = colliderRoot.BuildNameToComponentMap <Transform>(true);

                BuildDynamicsNulls(allChildren, dynamicsNullRecords);

                // New objects may have been created by SetupDynamicNulls, so retrieve all the children again
                allChildren = colliderRoot.BuildNameToComponentMap <Transform>(true);
                foreach (var record in colliderRecords)
                {
                    BuildColliderFromRecord(allChildren, record);
                }

                allChildren = colliderRoot.BuildNameToComponentMap <Transform>(true);
                BuildComponents(allChildren, componentRecords);
            }