GLSharp.Universe.Node.FindChild C# (CSharp) Method

FindChild() public method

public FindChild ( String id, System.Boolean deep ) : Node
id String
deep System.Boolean
return Node
        public Node FindChild(String id, Boolean deep)
        {
            if (this.Id == id)
                return this;

            if (this.Children[id] != null)
                return this.Children[id];

            if (!deep)
                return null;

            foreach (KeyValuePair<string, Node> child in Children) {
                Node ret = child.Value.FindChild(id, deep);

                if (ret != null)
                    return ret;
            }

            return null;
        }

Usage Example

Ejemplo n.º 1
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        protected override void BindParent()
        {
            /*geomerty nodes*/
            _mechNode = this.Parent.FindChild("mech", true);
            _headNode = this.Parent.FindChild("head", true);
            _bodyNode = this.Parent.FindChild("body", true);

            _ulegLeftNode = _bodyNode.FindChild("ulegl", true);
            _ulegRightNode = _bodyNode.FindChild("ulegr", true);

            _llegLeftNode = _ulegLeftNode.FindChild("llegl", true);
            _llegRightNode = _ulegRightNode.FindChild("llegr", true);

            _footLeftNode = _llegLeftNode.FindChild("footl", true);
            _footRightNode = _llegRightNode.FindChild("footr", true);

            /*animation*/
            this._animation.Animations.Add(_bodyNode.Animation);

            this._animation.Animations.Add(_ulegLeftNode.Animation);
            this._animation.Animations.Add(_ulegRightNode.Animation);

            this._animation.Animations.Add(_llegLeftNode.Animation);
            this._animation.Animations.Add(_llegRightNode.Animation);

            this._animation.Animations.Add(_footLeftNode.Animation);
            this._animation.Animations.Add(_footRightNode.Animation);

            this._animation.SetRange(0, 48, true);

            /*collision*/
            Node coll = _mechNode.FindChild("__cs_mech", true);
            this._collision = (CollisionComponent) coll.Components[Component.CollisionComponent];
        }