예제 #1
0
        public Node BuildHierarchy()
        {
            /**
             * 1. Fetch all objects
             * */
            List <Transform> topTransforms =
                (ClassMode == LevelLookupMode.GuiStagesOnly) ? FetchStages() : FetchTopTransforms();

#if DEBUG
            if (DebugMode)
            {
                StringBuilder sb = new StringBuilder(@"Root game objects in the hierarchy:
"); foreach (Transform go in topTransforms)
                {
                    sb.AppendLine(string.Format("    {0}", go.name));
                }

                Debug.Log(sb);
            }
#endif

            /**
             * 3. Create node for each root transform
             * Build each node and add the to root nodes collection
             * */
            _rootNode = new Node(null);

            foreach (Transform transform in topTransforms)
            {
                var node = new Node(transform);
                ComponentAdapter adapter = node.Transform.gameObject.GetComponent <ComponentAdapter>();

                if (null != adapter)
                {
                    node.Build();
                    _rootNode.Add(node);
                }
            }

            return(_rootNode);
        }
예제 #2
0
        public Node BuildHierarchy()
        {
            /**
             * 1. Fetch all objects
             * */
            List<Transform> topTransforms = 
                (ClassMode == LevelLookupMode.GuiStagesOnly) ? FetchStages() : FetchTopTransforms();
#if DEBUG
            if (DebugMode)
            {
                StringBuilder sb = new StringBuilder(@"Root game objects in the hierarchy:
"); foreach (Transform go in topTransforms)
                {
                    sb.AppendLine(string.Format("    {0}", go.name));
                }

                Debug.Log(sb);
            }
#endif

            /**
             * 3. Create node for each root transform
             * Build each node and add the to root nodes collection
             * */
            _rootNode = new Node(null);

            foreach (Transform transform in topTransforms)
            {
                var node = new Node(transform);
                ComponentAdapter adapter = node.Transform.gameObject.GetComponent<ComponentAdapter>();

                if (null != adapter)
                {
                    node.Build();
                    _rootNode.Add(node);
                }
            }

            return _rootNode;
        }