当前位置: 首页>>代码示例>>C#>>正文


C# Texture2D.Clear方法代码示例

本文整理汇总了C#中UnityEngine.Texture2D.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.Clear方法的具体用法?C# Texture2D.Clear怎么用?C# Texture2D.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Texture2D的用法示例。


在下文中一共展示了Texture2D.Clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

 private void Awake()
 {
     texture = new Texture2D(resolution, resolution) {filterMode = FilterMode.Point};
     texture.Clear(Color.clear);
     debugTexture = new Texture2D(resolution, resolution) {filterMode = FilterMode.Point};
     debugTexture.Clear(Color.clear);
 }
开发者ID:BasmanovDaniil,项目名称:Whoosh,代码行数:7,代码来源:FloorPlanGenerator.cs

示例2: Awake

        private void Awake()
        {
            texture = new Texture2D(width, height, TextureFormat.ARGB32, false, true)
            {
                filterMode = FilterMode.Point
            };
            texture.Clear(Color.clear);
            texture.Apply();
            image.texture = texture;

            header = InstantiateControl<TextControl>(leftPanel);
            header.transform.SetAsFirstSibling();

            var rulesetName = RulesetName.Life;
            SelectRuleset(rulesetName);

            for (int i = 0; i < rulesetNames.Length; i++)
            {
                RulesetName currentName = rulesetNames[i];
                var toggle = InstantiateControl<ToggleControl>(toggleGroup.transform);
                toggle.Initialize(
                    header: currentName.ToString(),
                    value: currentName == rulesetName,
                    onValueChanged: isOn =>
                    {
                        if (isOn)
                        {
                            SelectRuleset(currentName);
                            Generate();
                        }
                    },
                    toggleGroup: toggleGroup);
            }

            InstantiateControl<SliderControl>(leftPanel).Initialize("Start noise", 0, 1, startNoise, value =>
            {
                startNoise = value;
                Generate();
            });

            InstantiateControl<ToggleControl>(leftPanel).Initialize("Alive borders", aliveBorders, value =>
            {
                aliveBorders = value;
                Generate();
            });

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

            Generate();
        }
开发者ID:emomper23,项目名称:PsychVR,代码行数:50,代码来源:CellularAutomatonUI.cs

示例3: Generate

        private void Generate()
        {
            StopAllCoroutines();

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

            mazeGenerator = new MazeGenerator(textureWidth, textureHeight, cellSize, wallSize);

            StartCoroutine(GenerateCoroutine());
        }
开发者ID:reidblomquist,项目名称:ProceduralToolkit,代码行数:16,代码来源:MazeGeneratorUI.cs

示例4: GenerateCoroutine

        private IEnumerator GenerateCoroutine()
        {
            texture = new Texture2D(mazeWidth, mazeHeight, TextureFormat.ARGB32, false, true)
            {
                filterMode = FilterMode.Point
            };
            cellWidth = (mazeWidth - cellWallSize)/(cellSize + cellWallSize);
            cellHeight = (mazeHeight - cellWallSize)/(cellSize + cellWallSize);
            maze = new Maze(cellWidth, cellHeight);

            var origin = new Cell {x = Random.Range(0, cellWidth), y = Random.Range(0, cellHeight)};
            maze[origin] = Directions.None;
            edges = new List<Edge>(maze.GetEdges(origin));

            texture.Clear(Color.black);
            yield return null;

            switch (mazeAlgorithm)
            {
                case MazeAlgorithm.None:
                    if (RandomE.Chance(0.5f))
                    {
                        yield return StartCoroutine(RandomTraversal());
                    }
                    else
                    {
                        yield return StartCoroutine(RandomDepthFirstTraversal());
                    }
                    break;
                case MazeAlgorithm.RandomTraversal:
                    yield return StartCoroutine(RandomTraversal());
                    break;
                case MazeAlgorithm.RandomDepthFirstTraversal:
                    yield return StartCoroutine(RandomDepthFirstTraversal());
                    break;
            }

            texture.Apply();
        }
开发者ID:polyblank2,项目名称:ProceduralToolkit,代码行数:39,代码来源:Mazes.cs


注:本文中的UnityEngine.Texture2D.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。