本文整理汇总了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);
}
示例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();
}
示例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());
}
示例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();
}