Ejemplo n.º 1
0
 private static void CheckIfTileSetHasTileDefined(TileSet tileSet, TileKey tileKey)
 {
     if (!tileSet.TileKeys.Contains(tileKey))
     {
         throw new TileMapLogicException($"TileSet does not contain a tile with id: {tileKey.Id}");
     }
 }
Ejemplo n.º 2
0
        public void PlaceTile(int x, int y, TileSet tileSet, TileKey tileKey)
        {
            if (tileSet.Dimension != Dimension)
            {
                throw new TileMapLogicException("TileSet dimension must match TileMap dimension");
            }

            CheckIfTileSetHasTileDefined(tileSet, tileKey);
            if (!TileSetMap.TryGetTileSetMapping(tileSet.Id, out var mappedTileSet))
            {
                mappedTileSet = TileSetMap.MapNewTileSet(tileSet);
            }

            PlaceTileMapping(x, y, mappedTileSet.MapId, tileKey.Id);
        }