コード例 #1
0
        public Position GetTargetPositionAt(double cursorX, double cursorY, double hexRadius, HexOrientation hexOrientation)
        {
            Position bottomPosition = PositionUtils.FromCursor(cursorX, cursorY, hexRadius, hexOrientation);

            PieceName topPiece = (null != Board) ? Board.GetPieceOnTop(bottomPosition) : PieceName.INVALID;

            if (topPiece == PieceName.INVALID)
            {
                // No piece there, return position at bottom of the stack (stack == 0)
                return(bottomPosition);
            }
            else
            {
                // Piece present, return position on top of the piece
                return(Board.GetPiecePosition(topPiece).GetAbove());
            }
        }
コード例 #2
0
        public PieceName GetPieceAt(double cursorX, double cursorY, double hexRadius, HexOrientation hexOrientation)
        {
            Position position = PositionUtils.FromCursor(cursorX, cursorY, hexRadius, hexOrientation);

            return((null != Board) ? Board.GetPieceOnTop(position) : PieceName.INVALID);
        }