Beispiel #1
0
        /// <summary>
        /// Builds the node and its children using the transform relation (recursivelly!)
        /// </summary>
        public void Build()
        {
            foreach (Transform transform in Transform)
            {
                var childNode = new Node(transform)
                {
                    Depth = Depth + 1, _parentNode = this
                };

                //ComponentAdapter adapter = childNode.Transform.gameObject.GetComponent<ComponentAdapter>();
                //if (null != adapter)
                //{
                _childNodes.Add(childNode);
                childNode.Build();
                //}
            }

            //PersistOrder();
        }
        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);
        }
        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;
        }
Beispiel #4
0
        /// <summary>
        /// Builds the node and its children using the transform relation (recursivelly!)
        /// </summary>
        public void Build()
        {
            foreach (Transform transform in Transform)
            {
                var childNode = new Node(transform) {Depth = Depth + 1, _parentNode = this};

                //ComponentAdapter adapter = childNode.Transform.gameObject.GetComponent<ComponentAdapter>();
                //if (null != adapter)
                //{
                    _childNodes.Add(childNode);
                    childNode.Build();
                //}
            }

            //PersistOrder();
        }