/// <summary> /// 1. TileGrid, get dictionary form TileTypes, but do not create /// 2. Check if there is tilemap, and is correct Type. /// 3. do Algorithms. /// </summary> private void Awake() { TilesDictionary = InitializeTile(); TilemapType = new Dictionary <TilemapType, TilemapStructure>(); foreach (Transform child in transform) // get Transform from 'this' transform.gameobject { TilemapStructure tilemap = child.GetComponent <TilemapStructure>(); if (tilemap == null) { continue; // if there is no tilemap, return. } if (TilemapType.ContainsKey(tilemap.tilemapType)) { throw new Exception("Duplicate Tilemap type: " + tilemap.tilemapType); } TilemapType.Add(tilemap.tilemapType, tilemap); } foreach (TilemapStructure tilemap in TilemapType.Values) { tilemap.Initialize(); } }
private void Awake() { TilesDictionary = InitializeTile(); TilemapType = new Dictionary <TilemapType, TilemapStructure>(); foreach (Transform child in transform) { TilemapStructure tilemap = child.GetComponent <TilemapStructure>(); if (tilemap == null) { continue; } if (TilemapType.ContainsKey(tilemap.Type)) { throw new Exception("Duplicate Tilemap type: " + tilemap.Type); } TilemapType.Add(tilemap.Type, tilemap); } foreach (TilemapStructure tilemap in TilemapType.Values) { tilemap.Initialize(); } }