public void instantiate() { if (Map != null) { Clear(); } if (_root == null) { _root = new GameObject("Level"); } _root.tag = "Level"; Map = new GenericGridMap <IsoTransform>(prefab_size, WorldSize); Map.applyFunctionToMap((x, y, z) => MapToTile(x, y, z)); for (int i = 0; i < Map.tiles.Length; i++) { if (Map.map_objects[i] != null) { Map.map_objects[i].transform.parent = _root.transform; } //if (Map.tiles[i] != null) // Map.tiles[i].transform.parent = _root.transform; } }
/// <summary> /// Wraps GenericGridMap<T>.clear() for the custom editor /// </summary> public void Clear() { Map.clear(); Map = null; DestroyImmediate(_root); }