public override void OnInspectorGUI() { base.OnInspectorGUI(); MapGeneratorScript map = target as MapGeneratorScript; map.GenerateMap(); }
// Use this for initialization void Start() { MapGeneratorScript script = GetComponent <MapGeneratorScript>(); while (!generated && attempts < MAX_ATTEMPTS) { try { attempts++; script.GenerateMap(); generated = true; Debug.Log("successfully created map in " + attempts + " attempts"); } catch (Exception e) { Debug.Log("failed attempt number " + attempts); script.CleanUp(); Debug.Log(e); } } }
void Start() { if (instance == null) { instance = this; } GameObject map = null; if (useTestMap) { map = LoadMap(); LoadTiles(); this.GetComponent <FogInitializer>().GenerateFog(-7, 7, -15, 17); } else { MapGeneratorScript initializer = this.GetComponent <MapGeneratorScript>(); map = initializer.GenerateMap(); this.GetComponent <FogInitializer>().GenerateFog(0, initializer.WIDTH, 0, initializer.HEIGTH); } LoadPlayerUnits(map); initialized = true; }