示例#1
0
        public static List <Move> GetAvailableMoves(Tuple <int, int> selectedPieceCoords)
        {
            AvailableMoves.Clear();
            var Layout = GameState.GetGameState();

            if (Layout[selectedPieceCoords.Item1][selectedPieceCoords.Item2] == null ||
                Layout[selectedPieceCoords.Item1][selectedPieceCoords.Item2].PieceColor != GameState.PlayerTurn)
            {
                return(AvailableMoves);
            }

            if (NrOfMovesLeft(Layout) == 0)
            {
                EventsMediator.OnWinner(null, new PlayerEventArgs {
                    pieceColor = GameState.PlayerTurn
                });
                return(AvailableMoves);
            }

            AvailableMoves = Layout[selectedPieceCoords.Item1][selectedPieceCoords.Item2].GetAvailableMoves(selectedPieceCoords);
            AvailableMoves = DeleteIllegalMoves(AvailableMoves);

            return(AvailableMoves);
        }
示例#2
0
 private static void EndGame(object sender, EventArgs e)
 {
     EventsMediator.OnWinner(null, new PlayerEventArgs {
         pieceColor = GameState.PlayerTurn
     });
 }