//highlight single space in footprint
    private void PieceFootprintHighlight(int i, Vector2Int boardCoords, Puzzle.Piece piece, Vector2Int offset = default)
    {
        SelectionSpace.Colors color = SelectionSpace.Colors.White;

        var puzzle = this.Manager.PuzzleController.Puzzle;

        var coords = boardCoords + offset;

        if (puzzle.OutOfBounds(coords))
        {
            color = SelectionSpace.Colors.Red;
        }
        else if (!puzzle.IsFree(boardCoords, piece))
        {
            var overlap = puzzle.GetPiece(coords);
            if (overlap != null && overlap != piece)
            {
                color = SelectionSpace.Colors.Red;
            }
        }

        SingleSpaceHighlight(i, coords, color);
    }
Exemplo n.º 2
0
 public Rotation IsCompatible(Piece piece)
 {
     if (TopString == piece.TopString)
     {
         return Rotation.Top;
     }
     if (TopString == piece.RightString)
     {
         return Rotation.Right;
     }
     if (TopString==piece.BottomString)
     {
         return Rotation.Bottom;
     }
     if (TopString==piece.LeftString)
     {
         return Rotation.Left;
     }
     return Rotation.None;
 }
Exemplo n.º 3
0
 public void PlacePiece(Piece piece, int x, int y)
 {
     _puzzleBoard[y].PieceRow[x].PieceIDs= new int[]{piece.ID};
 }