Ejemplo n.º 1
0
        public List <PlayerPiece> GetPlayerPiecesBasedOnEntityType(EntityType entityType)
        {
            var playerPieces = new List <PlayerPiece>();

            for (int row = 0; row < Rows; row++)
            {
                for (int column = 0; column < Columns; column++)
                {
                    if (ChessBoardCells[row, column].IsOccupied)
                    {
                        Entity entity = ChessBoardCells[row, column].Entity;
                        if (entity.Type == entityType)
                        {
                            var playerPiece = new PlayerPiece
                            {
                                EntityID = entity.ID,
                            };

                            playerPiece.CurrentPosition = new ChessBoardPosition
                            {
                                CurrentRow    = row,
                                CurrentColumn = column,
                            };

                            playerPieces.Add(playerPiece);
                        }
                    }
                }
            }

            return(playerPieces);
        }
Ejemplo n.º 2
0
        public Entity GetEntity(PlayerPiece playerPiece)
        {
            ChessBoardCell cell = GetCell(playerPiece.CurrentPosition);

            return(cell.Entity);
        }