本文整理汇总了C#中UnityEngine.CanvasRenderer.GetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C# CanvasRenderer.GetAlpha方法的具体用法?C# CanvasRenderer.GetAlpha怎么用?C# CanvasRenderer.GetAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.CanvasRenderer
的用法示例。
在下文中一共展示了CanvasRenderer.GetAlpha方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FadeAndDestroyObject
IEnumerator FadeAndDestroyObject(CanvasRenderer renderer, float time)
{
float a = renderer.GetAlpha();
while (renderer.GetAlpha() > 0)
{
renderer.SetAlpha(renderer.GetAlpha() - (Time.deltaTime / time) * a);
yield return null;
}
Destroy(gameObject);
}
示例2: FadeIn
/// <summary>
/// Постепенно отображает объект UI (корутина).
/// </summary>
/// <returns>(Корутина).</returns>
/// <param name="renderer">CanvasRenderer объекта.</param>
/// <param name="time">Время появления.</param>
public static IEnumerator FadeIn(CanvasRenderer renderer, float time)
{
renderer.SetAlpha(0);
do
{
renderer.SetAlpha(renderer.GetAlpha() + Time.deltaTime / time);
yield return null;
}
while (renderer != null && renderer.GetAlpha() < 1);
}
示例3: Awake
public void Awake()
{
canvas_r = GetComponent<CanvasRenderer>();
canvas_group = GetComponent<CanvasGroup>();
if (canvas_group != null) alpha_initial = canvas_group.alpha;
else alpha_initial = canvas_r.GetAlpha();
}
示例4: FadeIn
IEnumerator FadeIn(CanvasRenderer renderer, float time)
{
renderer.SetAlpha(0);
do
{
renderer.SetAlpha(renderer.GetAlpha() + Time.deltaTime / time);
yield return null;
}
while (renderer.GetAlpha() < 1 && !Fading);
}