示例#1
0
    void generate(OPTIONS op)
    {
        if (GameObject.Find(objectName) != null)
        {
            EditorUtility.DisplayDialog("Error", "Object " + objectName + " already exists", "Ok", "");
        }
        else
        {
            Transform level = new GameObject(objectName).transform;
            if (useRandomSeed)
            {
                seed = Time.time.ToString();
            }
            System.Random rnd = new System.Random(seed.GetHashCode());
            switch (op)
            {
            case OPTIONS.Hauberk:
                Hauberk h = GameObject.Find(objectName).AddComponent <Hauberk> ();
                h.addRooms(rooms);
                h.setSeed(rnd);
                h.setIsRandomSeed(useRandomSeed);
                h.GenerateLevel(mapSize, level, tilePrefab, outlinePercent);
                break;

            case OPTIONS.Cave:
                Cave c = GameObject.Find(objectName).AddComponent <Cave>();
                c.setSeed(rnd);
                c.setIsRandomSeed(useRandomSeed);
                //c.GenerateLevel(level, randomFillPercent, width, height);
                break;

            case OPTIONS.TEST:
                Debug.Log("Testing...");
                Debug.Log(System.IO.Directory.GetCurrentDirectory());

                SimpleProgressBar window1 = new SimpleProgressBar();
                //ProgressBarTest window1 = new ProgressBarTest();
                window1.setup();
                window1.ShowPopup();
                window1.log        = "Initialized builder... v2";
                window1.isBuilding = true;
                window1.listLength = 5;

                window1.doStep();
                window1.doStep();
                window1.doStep();
                window1.doStep();
                window1.doStep();
                break;

            default:
                Debug.LogError("Unrecognized Option");
                break;
            }
        }
    }
示例#2
0
    void generate(OPTIONS op)
    {
        if (GameObject.Find(objectName) != null)
        {
            EditorUtility.DisplayDialog("Error", "Object " + objectName + " already exists", "Ok", "");
        }
        else
        {
            Transform level = new GameObject(objectName).transform;
            if (useRandomSeed)
            {
                seed = Time.time.ToString();
            }
            System.Random rnd = new System.Random(seed.GetHashCode());
            switch (op)
            {
            case OPTIONS.Hauberk:
                Hauberk h = GameObject.Find(objectName).AddComponent <Hauberk> ();
                h.addRooms(rooms);
                h.setSeed(rnd);
                h.setIsRandomSeed(useRandomSeed);
                h.GenerateLevel(mapSize, level, tilePrefab, outlinePercent, true, attempts);
                break;

            case OPTIONS.Cave:
                Debug.Log(OPTIONS.Cave + " doesn't work right now...");

                /*Cave c = GameObject.Find (objectName).AddComponent<Cave>();
                 *  c.setSeed(rnd);
                 * c.setIsRandomSeed (useRandomSeed);
                 *  c.GenerateLevel(level, randomFillPercent, width, height);#*/
                break;

            case OPTIONS.TEST:
                Debug.Log("Testing...");
                Debug.Log(System.IO.Directory.GetCurrentDirectory());
                break;

            default:
                Debug.LogError("Unrecognized Option");
                break;
            }
        }
    }