public CollisionPoint(float x, float y, CollisionPoint h, CollisionPoint p) { head = h; this.p = p; this.x = x; this.y = y; }
public void Add(float x, float y) { if (n == null) { n = new CollisionPoint(x, y, head, this); } else { n.Add(x, y); } }
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); } }
/// <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; }
public void RemoveHead() { head = null; }
/// <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); } }