Esempio n. 1
0
        public (bool, MoveOption) SelectTile(Point position)
        {
            MoveOption option = currentOptions.Find(o => o.Spot.Equals(position));

            if (option != null)
            {
                if (selectedPiece != null)
                {
                    bool kinged = (selectedPiece.Owner == PlayerType.Player1 && option.Spot.Y == 0) || (selectedPiece.Owner == PlayerType.Player2 && option.Spot.Y == 7);
                    selectedPiece.Position = option.Spot;
                    if (kinged)
                    {
                        selectedPiece.Type = PieceType.King;
                    }
                    option.HoppedPieces.ForEach(delegate(Point hoppedPoint) {
                        pieces.RemoveAll(p => p.Position.Equals(hoppedPoint));
                    });
                    selectedPiece = null;
                    return(kinged, option);
                }
                else
                {
                    // no piece in that spot (probably will never happen)
                    return(false, null);
                }
            }
            else
            {
                // invalid tile
                return(false, null);
            }
        }
Esempio n. 2
0
 public void TileSelect(bool kinged, MoveOption option)
 {
     TileSelected?.Invoke(kinged, option);
 }