public Token InstantiateAndPoolToken(Token.ColorType color, bool temporary = false) { Token token = Token.CreateToken(color, temporary); AddToken(token); return(token); }
private static bool IsGridCellViable(int i, int j, Token.ColorType color) { if (i < 0 || i > GridSize - 1 || j < 0 || j > GridSize - 1) { return(false); } return(!GridCells[i, j].IsEmpty() && !CellsChecked[i, j] && GridCells[i, j].Token.Color == color); }
public Token PullToken(Token.ColorType color) { for (int i = 0; i < Tokens.Count; i++) { if (Tokens[i].Color == color) { return(PullToken(Tokens[i])); } } return(null); }
public static int Tokens(Player owner, Token.ColorType firstColor, Token.ColorType secondColor) { int count = 0; foreach (GridCell gridCell in GridCells) { if (gridCell.Owner == owner && (gridCell.Token.Color == firstColor || gridCell.Token.Color == secondColor)) { count++; } } return(count); }
public static int Tokens(Player owner, Token.ColorType color) { int count = 0; foreach (GridCell gridCell in GridCells) { if (gridCell.Owner == owner && gridCell.Token.Color == color) { count++; } } return(count); }
public static int Tokens(Token.ColorType color) { int count = 0; foreach (GridCell gridCell in GridCells) { if (gridCell.Token.Color == color) { count++; } } return(count); }
static bool RecursiveCheckNeighbors(int i, int j, Token.ColorType color, ref List <GridCell> currentCells, Player currentPlayer) { if (!GridCells[i, j].HasOwner()) { return(false); } CellsChecked[i, j] = true; if (GridCells[i, j].Owner == currentPlayer) { currentCells.Add(GridCells[i, j]); } else { return(true); } bool hasOwner = true; if (IsGridCellViable(i - 1, j, color)) { if (!RecursiveCheckNeighbors(i - 1, j, color, ref currentCells, currentPlayer)) { hasOwner = false; } } if (IsGridCellViable(i + 1, j, color)) { if (!RecursiveCheckNeighbors(i + 1, j, color, ref currentCells, currentPlayer)) { hasOwner = false; } } if (IsGridCellViable(i, j - 1, color)) { if (!RecursiveCheckNeighbors(i, j - 1, color, ref currentCells, currentPlayer)) { hasOwner = false; } } if (IsGridCellViable(i, j + 1, color)) { if (!RecursiveCheckNeighbors(i, j + 1, color, ref currentCells, currentPlayer)) { hasOwner = false; } } return(hasOwner); }
public int ColorAmount(Token.ColorType color) { if (color == Token.ColorType.Red) { return(Amount.Red); } if (color == Token.ColorType.Green) { return(Amount.Green); } else { return(Amount.Blue); } }
public void UseMarker(Token.ColorType color) { ManaCost newTokenMarker; if (color == Token.ColorType.Red) { newTokenMarker = new ManaCost(-1, 0, 0); } else if (color == Token.ColorType.Green) { newTokenMarker = new ManaCost(0, -1, 0); } else { newTokenMarker = new ManaCost(0, 0, -1); } AddMarkers(newTokenMarker); }
Vector3 CalculateManaTokenPosition(Token.ColorType color) { float rowSize; Vector3 newPos = Vector3.zero; switch (color) { case Token.ColorType.Red: rowSize = RedManaTokens.Count; newPos = RED_PLACEMENT - Vector3.up * rowSize; break; case Token.ColorType.Green: rowSize = GreenManaTokens.Count; newPos = GREEN_PLACEMENT - Vector3.up * rowSize; break; case Token.ColorType.Blue: rowSize = BlueManaTokens.Count; newPos = BLUE_PLACEMENT - Vector3.up * rowSize; break; } return(newPos); }
static void SpawnTokenInBag(Token.ColorType color) { TokenBag.InstantiateAndPoolToken(color); }