Example #1
0
        private void Awake()
        {
            config.drawEdge = DrawEdge;

            int textureWidth  = MazeGenerator.GetMapWidth(config.width, wallSize, roomSize);
            int textureHeight = MazeGenerator.GetMapHeight(config.height, wallSize, roomSize);

            texture = new Texture2D(textureWidth, textureHeight, TextureFormat.ARGB32, false, true)
            {
                filterMode = FilterMode.Point
            };
            mazeImage.texture = texture;

            var header = InstantiateControl <TextControl>(algorithmsGroup.transform.parent);

            header.Initialize("Generator algorithm");
            header.transform.SetAsFirstSibling();

            InstantiateToggle(MazeGenerator.Algorithm.RandomTraversal, "Random traversal");
            InstantiateToggle(MazeGenerator.Algorithm.RandomDepthFirstTraversal, "Random depth-first traversal");

            InstantiateControl <ToggleControl>(leftPanel).Initialize("Use gradient", useGradient, value =>
            {
                useGradient = value;
                Generate();
            });

            InstantiateControl <ButtonControl>(leftPanel).Initialize("Generate new maze", Generate);

            Generate();
            SetupSkyboxAndPalette();
        }