public ChessBoardSprite FindTileByBoardCoord(string boardCoord) { ChessBoardSprite foundSprites = null; foreach (Sprite s in Sprites) { if (s.GetType() == typeof(ChessBoardSprite)) { if (s.BoardPosition.ToCoordinate() == boardCoord) { foundSprites = (ChessBoardSprite)s; } } } return(foundSprites); }
private void AddChessBoard() { for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { bool isDark = ((x + y) % 2 != 0); PieceMaterial material = (isDark ? PieceMaterial.D : PieceMaterial.L); string textureFilename = "chessboard_" + (isDark ? "dark" : "light") + ".png"; ChessBoardSprite boardSprite = new ChessBoardSprite(content, material, new Vector2D(x * TextureDimension, y * TextureDimension), new Vector2D(x, y)); Sprites.Add(boardSprite); } } }