/// <summary> /// Checks whether there are potential capture lines on the y axis in a specific direction from the given coordinates /// </summary> /// <param name="x">X coordinate of the given tile</param> /// <param name="y">Y coordinate of the given tile</param> /// <param name="operation">Direction the function checks in (positive 1 or negative 1 for up or down respectively)</param> /// <returns>Boolean indicating the possibility</returns> private bool checkForYCapture(int x, int y, int operation) { y += operation; bool repeat = inBounds(y); if (inBounds(y)) { if (tileStore[x, y].GetComponent <TileScript>().GetOwner() == gameManager.GetCurrentPlayer() || tileStore[x, y].GetComponent <TileScript>().GetOwner() == GameManager.Player.NONE) { return(false); } } y += operation; repeat = repeat && inBounds(y); // At this point, the adjacent tile definitely belongs to the opponent while (repeat) { if (tileStore[x, y].GetComponent <TileScript>().GetOwner() == gameManager.GetCurrentPlayer()) { return(true); } else if (tileStore[x, y].GetComponent <TileScript>().GetOwner() == GameManager.Player.NONE) { break; } y += operation; repeat = repeat && inBounds(y); } return(false); }