Exemplo n.º 1
0
        private void DetachNode(int index, GameWorld gameWorld, ref GameObject parent)
        {
            if (this.Next != 0)
            {
                gameWorld.Objects[this.Next].Prev = this.Prev;
            }

            if (this.Prev != 0)
            {
                gameWorld.Objects[this.Prev].Next = this.Next;
            }

            if (parent.FirstChild == index)
            {
                parent.FirstChild = this.Next;
            }

            if (parent.LastChild == index)
            {
                parent.LastChild = this.Prev;
            }

            this.Parent = 0;
            this.Next = 0;
            this.Prev = 0;
        }
Exemplo n.º 2
0
 /// <summary>
 /// The attach node tail.
 /// </summary>
 /// <param name="index">
 /// The index.
 /// </param>
 /// <param name="parent">
 /// The parent.
 /// </param>
 /// <param name="parentObject">
 /// The parent object.
 /// </param>
 /// <param name="world">
 /// The world.
 /// </param>
 public void AttachNodeTail(int index, int parent, ref GameObject parentObject, GameWorld world)
 {
     this.Parent = parent;
     this.Prev = parentObject.LastChild;
     this.Next = 0;
     parentObject.LastChild = index;
     if (parentObject.FirstChild == 0)
     {
         parentObject.FirstChild = index;
     }
     else
     {
         world.Objects[this.Prev].Next = index;
     }
 }