Exemplo n.º 1
0
 public CollisionPoint(float x, float y, CollisionPoint h, CollisionPoint p)
 {
     head = h;
     this.p = p;
     this.x = x;
     this.y = y;
 }
Exemplo n.º 2
0
 public void Add(float x, float y)
 {
     if (n == null)
     {
         n = new CollisionPoint(x, y, head, this);
     }
     else
     {
         n.Add(x, y);
     }
 }
Exemplo n.º 3
0
 public void Add(float x, float y)
 {
     if (head == null)
     {
         head = new CollisionPoint(x, y, null, null);
         head.SetHead(head);
     }
     else
     {
         head.Add(x, y);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// deletes node overlapping with (x,y)
        /// </summary>
        /// <returns>True if node is deleted</returns>
        public bool Delete(int x, int y)
        {
            if (head != null &&
                head.Next == null)
            {
                RemoveHead();
                return true;
            }
            else if (head != null)
            {
                CollisionPoint c = head;

                while (c != null)
                {
                    if (c.CheckBounds(x, y))
                    {
                        if (!c.Delete())
                        {
                            head = null;
                            return true;
                        }
                        return true;
                    }
                    c = c.Next;
                }
            }

            return false;
        }
Exemplo n.º 5
0
 public void RemoveHead()
 {
     head = null;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Sets head node, for this node and ever node after
 /// </summary>
 /// <param name="c">head node</param>
 public void SetHead(CollisionPoint c)
 {
     head = c;
     if (n != null)
     {
         n.SetHead(c);
     }
 }