void Start() { if (!TilePrefab) { return; } Tile prefabTile = TilePrefab.GetComponent <Tile>(); if (!prefabTile) { return; } TileBehaviorDatabase.Init(); _Tiles = new Tile[LevelData.Width, LevelData.Height]; _Items = new Item[LevelData.Width, LevelData.Height]; for (int x = 0; x < LevelData.Width; x++) { for (int y = 0; y < LevelData.Height; y++) { if (!_Tiles[x, y]) { TileType tileType = LevelData.GetTileType(x, y); GameObject newTile = Instantiate(TilePrefab); _Tiles[x, y] = newTile.GetComponent <Tile>(); _Tiles[x, y].Init(new Vector2Int(x, y), tileType, transform, this); } ItemType itemType = LevelData.GetItemType(x, y); if (itemType != ItemType.None) { GameObject newItem = Instantiate(ItemPrefab); _Items[x, y] = newItem.GetComponent <Item>(); _Items[x, y].Init(new Vector2Int(x, y), itemType, transform, Itemset.GetSprite(itemType)); } } } Hero.SetTilePosition(LevelData.EntranceTilePosition); CameraController.SetLocalPosition(new Vector3(LevelData.Width / 2.0f - 0.5f, LevelData.Height / 2.0f - 0.5f)); }