Beispiel #1
0
    public static bool[,] mitNiveau(int niveau, out int d, out int x, out int y)
    {
        switch (niveau)
        {
        case 1:
            return(Tafel.GenerateMaze(0, 0, false, 0, out d, out x, out y));

        case 2:
            var ar = Tafel.GenerateManyCrosses();
            d = Tafel.PrüfRichtung(ar, out x, out y);
            return(ar);

        case 3:
            return(GenerateWithDensity(1, 0.1f, out d, out x, out y, false));

        case 4:
            return(Tafel.GenerateWithDensity(1, 0.5f, out d, out x, out y, false));

        case 5:
            return(Tafel.GenerateWithDensity(1, 0.5f, out d, out x, out y, false));

        case 6:
            return(Tafel.GenerateWithDensity(1, 0.5f, out d, out x, out y, true));

        case 7:
            return(Tafel.GenerateWithDensity(1, 0.9f, out d, out x, out y, true));

        case 8:
            return(Tafel.GenerateWithDensity(2, 0.1f, out d, out x, out y, false));

        case 9:
            return(Tafel.GenerateWithDensity(2, 0.9f, out d, out x, out y, false));

        case 10:
            return(Tafel.GenerateWithDensity(2, 0.5f, out d, out x, out y, false));

        case 11:
            return(Tafel.GenerateWithDensity(3, 0.1f, out d, out x, out y, false));

        case 12:
            return(Tafel.GenerateWithDensity(3, 0.9f, out d, out x, out y, false));

        case 13:
            return(Tafel.GenerateWithDensity(3, 0.5f, out d, out x, out y, false));

        case 14:
            return(Tafel.GenerateWithDensity(3, 0.5f, out d, out x, out y, false));

        case 15:
            return(Tafel.GenerateWithDensity(3, 0.5f, out d, out x, out y, false));

        default:
            x = 0;
            y = 0;
            d = -2;
            return(null);
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (startstring != "")
        {
            _ar         = Tafel.FromString(startstring);
            startstring = "";
        }

        if (regentex)
        {
            regentex = false;
            StartCoroutine("GenTex");
        }
        if (l1)
        {
            l1 = false;

            _ar = Tafel.mitNiveau(1, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l2)
        {
            l2 = false;

            _ar = Tafel.mitNiveau(2, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l3)
        {
            l3 = false;

            _ar = Tafel.mitNiveau(3, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l4)
        {
            l4 = false;

            _ar = Tafel.mitNiveau(4, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l5)
        {
            l5 = false;

            _ar = Tafel.mitNiveau(5, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l6)
        {
            l6 = false;

            _ar = Tafel.mitNiveau(6, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l7)
        {
            l7 = false;

            _ar = Tafel.mitNiveau(7, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l8)
        {
            l8 = false;

            _ar = Tafel.mitNiveau(8, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l9)
        {
            l9 = false;

            _ar = Tafel.mitNiveau(9, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l10)
        {
            l10 = false;

            _ar = Tafel.mitNiveau(10, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l11)
        {
            l11 = false;

            _ar = Tafel.mitNiveau(11, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l12)
        {
            l12 = false;

            _ar = Tafel.mitNiveau(12, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l13)
        {
            l13 = false;

            _ar = Tafel.mitNiveau(13, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l14)
        {
            l14 = false;

            _ar = Tafel.mitNiveau(14, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }
        if (l15)
        {
            l15 = false;

            _ar = Tafel.mitNiveau(15, out _d, out _x, out _y);
            Debug.Log(Tafel.ToString(_ar));
        }

        if (Input.GetKeyDown(KeyCode.P) && _ar != null)
        {
            _d = Tafel.PrüfRichtungMitHinzuhinzufügen(_ar, out _x, out _y);
            Debug.Log("PrüfRichtungMitHinzuhinzufügen " + _d);
        }

        var generate = -1;

        if (Input.GetKeyDown(KeyCode.N))
        {
            generate = 1;
        }
        else if (Input.GetKeyDown(KeyCode.M))
        {
            generate = 2;
        }
        else if (Input.GetKeyDown(KeyCode.Comma))
        {
            generate = 3;
        }

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            density = 0.1f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            density = 0.2f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            density = 0.3f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            density = 0.4f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            density = 0.5f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            density = 0.6f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha7))
        {
            density = 0.7f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha8))
        {
            density = 0.8f;
        }
        if (Input.GetKeyDown(KeyCode.Alpha9))
        {
            density = 0.9f;
        }

        if (generate > 0)
        {
            Tafel.GenerateWithDensity(generate, density, out _d, out _x, out _y, false);
        }
        if (_ar != null)
        {
            ZeigTafel(_ar, _d, _x, _y);
        }
    }