Ejemplo n.º 1
0
    private bool CheckNeighbor(Vector3Int position, PuzzlePiece toolPiece, int xOffset, int yOffset)
    {
        TileBase tile = tiles.GetTile(new Vector3Int(position.x + xOffset, position.y + yOffset, position.z));

        if (tile == null)
        {
            return(true);
        }
        PuzzlePiece targetPuzzlePiece;

        if (puzzlePieceMap.TryGetValue(tile.name, out targetPuzzlePiece))
        {
            if (toolPiece.CannotPlantNextTo(targetPuzzlePiece))
            {
                return(false);
            }
        }
        return(true);
    }