build method

Tile build(
  1. ItemMatrixProperties prop
)

Implementation

Tile build(ItemMatrixProperties prop) {
  Iterable<MapTerrain> findList = terrainList.where(
    (element) => element.value == prop.value,
  );

  if (findList.isEmpty) {
    return _buildDefault(prop);
  }

  try {
    if (prop.isCenterTile) {
      MapTerrain terrain = findList.where((element) {
        return element is! MapTerrainCorners;
      }).first;
      return _buildTile(terrain, prop);
    } else {
      return _buildTileCorner(findList, prop);
    }
  } catch (e) {
    return _buildDefault(prop);
  }
}