예제 #1
0
        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");
            Debug.Assert(child != this, "Can not add myself to myself.");

            if (m_pChildren == null)
            {
                m_pChildren = new CCRawList<CCNode>();
            }

            InsertChild(child, zOrder, tag);

            child.Parent = this;
            child.m_nTag = tag;
            child.m_uOrderOfArrival = s_globalOrderOfArrival++;
            if (child.m_bCleaned)
            {
                child.ResetCleanState();
            }

            if (m_bRunning)
            {
                child.OnEnter();
                child.OnEnterTransitionDidFinish();
            }
        }