本文整理匯總了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);
}