private void Awake() { pixels = new Color[width * height]; texture = PTUtils.CreateTexture(width, height, Color.clear); image.texture = texture; header = InstantiateControl <TextControl>(leftPanel); header.transform.SetAsFirstSibling(); header.Initialize("Noise type:"); InstantiateToggle(FastNoise.NoiseType.Perlin); InstantiateToggle(FastNoise.NoiseType.PerlinFractal); InstantiateToggle(FastNoise.NoiseType.Simplex); InstantiateToggle(FastNoise.NoiseType.SimplexFractal); InstantiateToggle(FastNoise.NoiseType.Cubic); InstantiateToggle(FastNoise.NoiseType.CubicFractal); InstantiateToggle(FastNoise.NoiseType.Value); InstantiateToggle(FastNoise.NoiseType.ValueFractal); InstantiateToggle(FastNoise.NoiseType.Cellular); InstantiateToggle(FastNoise.NoiseType.WhiteNoise); noise = new FastNoise(); Generate(); SetupSkyboxAndPalette(); }
private void Awake() { config.drawEdge = DrawEdge; int textureWidth = MazeGenerator.GetMapWidth(config.width, wallSize, roomSize); int textureHeight = MazeGenerator.GetMapHeight(config.height, wallSize, roomSize); texture = PTUtils.CreateTexture(textureWidth, textureHeight, Color.black); 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(); }
private void Awake() { texture = PTUtils.CreateTexture(textureSize, textureSize, Color.clear); pixels = texture.GetPixels(); image.texture = texture; var slider = InstantiateControl <SliderControl>(leftPanel.transform); slider.Initialize("Threshold", 0, 1, threshold, value => { threshold = value; Generate(); }); var toggle = InstantiateControl <ToggleControl>(leftPanel.transform); toggle.Initialize("Animate", animate, isOn => animate = isOn); noise = new FastNoise(); noise.SetNoiseType(FastNoise.NoiseType.SimplexFractal); UpdateTexture(); Generate(); GeneratePalette(); SetupSkyboxAndPalette(); }
private void Awake() { pixels = new Color[config.width * config.height]; texture = PTUtils.CreateTexture(config.width, config.height, Color.clear); image.texture = texture; cells = new Cells(config); #region Controls header = InstantiateControl <TextControl>(leftPanel); header.transform.SetAsFirstSibling(); var currentRulesetName = RulesetName.Life; SelectRuleset(currentRulesetName); InstantiateToggle(RulesetName.Life, currentRulesetName); InstantiateToggle(RulesetName.Mazectric, currentRulesetName); InstantiateToggle(RulesetName.Coral, currentRulesetName); InstantiateToggle(RulesetName.WalledCities, currentRulesetName); InstantiateToggle(RulesetName.Coagulations, currentRulesetName); InstantiateToggle(RulesetName.Anneal, currentRulesetName); InstantiateToggle(RulesetName.Majority, currentRulesetName); InstantiateControl <SliderControl>(leftPanel).Initialize("Start noise", 0, 1, config.startNoise, value => { config.startNoise = value; Generate(); }); InstantiateControl <ToggleControl>(leftPanel).Initialize("Alive borders", config.aliveBorders, value => { config.aliveBorders = value; Generate(); }); InstantiateControl <ButtonControl>(leftPanel).Initialize("Generate", Generate); #endregion Controls Generate(); SetupSkyboxAndPalette(); }
private void Awake() { int textureWidth = MazeUtility.GetTextureWidth(config.width); int textureHeight = MazeUtility.GetTextureHeight(config.height); texture = PTUtils.CreateTexture(textureWidth, textureHeight, Color.black); mazeImage.texture = texture; var header = InstantiateControl <TextControl>(algorithmsGroup.transform.parent); header.Initialize("Generator algorithm"); header.transform.SetAsFirstSibling(); InstantiateToggle(MazeJob.Algorithm.RandomTraversal, "Random traversal"); InstantiateToggle(MazeJob.Algorithm.RandomDepthFirstTraversal, "Random depth-first traversal"); InstantiateControl <ButtonControl>(leftPanel).Initialize("Generate new maze", Generate); Generate(); SetupSkyboxAndPalette(); }