public KeyValuePair <Sprite, Sprite> GetSpriteForBoard(BoardStyle boardStyle) { Sprite spriteWhite = Resources.Load <Sprite>(string.Format("BoardStyles\\{0}_White", boardStyle)); Sprite spriteBlack = Resources.Load <Sprite>(string.Format("BoardStyles\\{0}_Black", boardStyle)); return(new KeyValuePair <Sprite, Sprite>(spriteWhite, spriteBlack)); }
public BoardProperties(BoardType board, DictionaryType dictionary, BoardStyle style, string letters) { Style = style; Board = board; Dictionary = dictionary; Letters = letters; }
public Board(int rows, int cols, BoardStyle style) { this.rows = rows; this.cols = cols; this.style = style; pieces = new List <Piece>(); CreateTiles(); CreatePieces(); if (BoardStyleChanged != null) { BoardStyleChanged(style); } }
private void Board_BoardStyleChanged(BoardStyle boardStyle) { KeyValuePair <Sprite, Sprite> whiteToBlack = GetSpriteForBoard(boardStyle); for (int i = 0; i < board.Cols; i++) { for (int j = 0; j < board.Rows; j++) { GameObject tileGO = BoardController.Instance.GetGameObjectOfTile(board.GetTileAt(i, j)); if ((i * board.Rows + j) % 2 == i % 2) { tileGO.GetComponent <SpriteRenderer>().sprite = whiteToBlack.Key; } else { tileGO.GetComponent <SpriteRenderer>().sprite = whiteToBlack.Value; } } } }