public IntRect(ArrayPoint offset, ArrayPoint dimensions) { if (dimensions.X < 0 || dimensions.Y < 0) { this.dimensions = ArrayPoint.Zero; } else { this.dimensions = dimensions; } this.offset = offset; }
void FloodFill(int x, int y, string tag) { Debug.Log(x); Debug.Log(y); Debug.Log("Got this far"); if ((x > -1 && x < boardDimension) && (y > -1 && y < boardDimension)) { Debug.Log("Two Layers Deep"); if (tag.Equals(board[x, y].tag) && CompareIndexes(x, y)) { Debug.Log("How far does this go"); ArrayPoint n = new ArrayPoint(); n.xPos = x; n.yPos = y; destroyList.Add(n); FloodFill(x + 1, y, tag); FloodFill(x - 1, y, tag); FloodFill(x, y + 1, tag); FloodFill(x, y - 1, tag); } } }
bool CompareArrayPoints(ArrayPoint x, ArrayPoint y) { if (x.xPos == y.xPos && x.yPos == y.yPos) return true; return false; }
ArrayPoint FindIndex(GameObject obj) { ArrayPoint newPoint = new ArrayPoint(); for (int i = 0; i < boardDimension; i++) { for (int j = 0; j < boardDimension; j++) { if (board[i, j].Equals(obj)) { newPoint.xPos = i; newPoint.yPos = j; return newPoint; } } } newPoint.xPos = 9001; return newPoint; }
public IntRect IncDimensions(ArrayPoint increase) { return new IntRect(offset, dimensions + increase); }
public IntRect Subtract(ArrayPoint newOffset) { return new IntRect(offset - newOffset, dimensions); }
public IntRect Translate(ArrayPoint newOffset) { return new IntRect(offset + newOffset, dimensions); }
public IntRect Subtract(ArrayPoint point) { return new IntRect(offset - point, dimensions); }
public static PointyHexPoint GridPointFromArrayPoint(ArrayPoint point) { return(PointyHexGrid <TCell> .GridPointFromArrayPoint(point)); }