public virtual void addChild(CCNode child, int zOrder, int tag) { if (child == null) { throw new ArgumentNullException("child", "Child can not be null."); } if (child.m_pParent == null) { this.insertChild(child, zOrder); child.m_nTag = tag; child.parent = this; if (this.m_bIsRunning) { child.onEnter(); child.onEnterTransitionDidFinish(); } } }
/// <summary> /// Adds a child to the container with z order and tag /// If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. /// @since v0.7.1 /// </summary> public virtual void addChild(CCNode child, int zOrder, int tag) { Debug.Assert(child != null, "Argument must be non-null"); Debug.Assert(child.m_pParent == null, "child already added. It can't be added again"); insertChild(child, zOrder); child.m_nTag = tag; child.parent = this; if (m_bIsRunning) { child.onEnter(); child.onEnterTransitionDidFinish(); } }
/// <summary> /// Adds a child to the container with z order and tag /// If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately. /// @since v0.7.1 /// </summary> public virtual void addChild(CCNode child, int zOrder, int tag) { if (child == null) { throw (new ArgumentNullException("child", "Child can not be null.")); } if (child.m_pParent != null) { Debug.WriteLine("child in addChild is already added. Child tag=" + tag + ", parent=" + child.m_pParent.tag); return; } insertChild(child, zOrder); child.m_nTag = tag; child.parent = this; if (m_bIsRunning) { child.onEnter(); child.onEnterTransitionDidFinish(); } }