Pathfinding.RecastBBTree.RemoveBox C# (CSharp) Method

RemoveBox() private method

private RemoveBox ( RecastBBTreeBox c, RecastMeshObj mesh, Rect bounds, bool &found ) : RecastBBTreeBox
c RecastBBTreeBox
mesh RecastMeshObj
bounds UnityEngine.Rect
found bool
return RecastBBTreeBox
		RecastBBTreeBox RemoveBox (RecastBBTreeBox c, RecastMeshObj mesh, Rect bounds, ref bool found) {
			if (!RectIntersectsRect(c.rect, bounds)) {
				return c;
			}

			if (c.mesh == mesh) {
				found = true;
				return null;
			}

			if (c.mesh == null && !found) {
				c.c1 = RemoveBox(c.c1, mesh, bounds, ref found);
				if (c.c1 == null) {
					return c.c2;
				}

				if (!found) {
					c.c2 = RemoveBox(c.c2, mesh, bounds, ref found);
					if (c.c2 == null) {
						return c.c1;
					}
				}

				if (found) {
					c.rect = ExpandToContain(c.c1.rect, c.c2.rect);
				}
			}
			return c;
		}