Exemple #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        MapGeneratorScript map = target as MapGeneratorScript;

        map.GenerateMap();
    }
Exemple #2
0
    // 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);
            }
        }
    }
Exemple #3
0
    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;
    }