本文整理汇总了C#中UnityEngine.CanvasRenderer.SetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C# CanvasRenderer.SetAlpha方法的具体用法?C# CanvasRenderer.SetAlpha怎么用?C# CanvasRenderer.SetAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.CanvasRenderer
的用法示例。
在下文中一共展示了CanvasRenderer.SetAlpha方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Start
// Use this for initialization
void Start()
{
textRenderer = GetComponent<CanvasRenderer>();
fadeTimeRemaining = fadeSec;
state = DisplayState_e.FADE_IN;
textRenderer.SetAlpha(0);
}
示例3: Awake
void Awake()
{
_backgroundRenderer = gameObject.transform.Find("Background").GetComponent<CanvasRenderer>();
_indicatorRenderer = gameObject.transform.Find("Indicator").GetComponent<CanvasRenderer>();
_backgroundRenderer.SetAlpha(_currentAlpha);
_indicatorRenderer.SetAlpha(_currentAlpha);
}
示例4: Awake
// Use this for initialization
void Awake()
{
textField = transform.Find("Text").gameObject.GetComponent<UnityEngine.UI.Text>();
canvRenderer = GetComponent<CanvasRenderer>();
canvRenderer.SetAlpha(0.0f);
initCaptions ();
}
示例5: Start
// Use this for initialization
void Start()
{
pauseScreen = transform.FindChild("PauseScreen").gameObject.GetComponent<CanvasRenderer>();
pauseScreen.SetAlpha(0);
gameOverScreen = transform.FindChild("GameOverScreen").gameObject.GetComponent<CanvasRenderer>();
gameOverScreen.SetAlpha(0);
}
示例6: Start
// Use this for initialization
void Start()
{
finishedAnim = false;
initialiseElements = true;
optionsContainer = GameObject.Find("UI Color Options").GetComponent<RectTransform>();
UIBox = GameObject.Find("UIBox").GetComponent<CanvasRenderer>();
UIBox.SetAlpha(0);
}
示例7: Awake
#pragma warning disable 0618
void Awake() {
button = gameObject.GetComponent<UnityEngine.UI.Button>() as UnityEngine.UI.Button;
buttonRenderer = button.GetComponentInChildren<CanvasRenderer>() as CanvasRenderer;
text = button.GetComponentInChildren<Text>() as Text;
// Hide the button
button.enabled = false;
buttonRenderer.SetAlpha(0);
text.color = Color.clear;
}
示例8: 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);
}
示例9: Start
// Use this for initialization
void Start()
{
finishedAnim = false;
initialiseElements = true;
optionsContainer = GameObject.Find("Options").GetComponent<RectTransform>();
spaceship = GameObject.Find("Spaceship").GetComponent<RectTransform>();
optionsHelp = GameObject.Find("Options Tutorial").GetComponent<CanvasRenderer>();
optionsHelp.SetAlpha(0);
}
示例10: Start
// Use this for initialization
void Start()
{
// Retrieve the canvas and make the button disabled to begin
canvasRenderer = gameObject.GetComponent<CanvasRenderer>();
canvasRenderer.SetAlpha(0.25f);
// Retrieve the menu item's text
menuItemText = gameObject.GetComponentInChildren<UnityEngine.UI.Text>();
menuItemText.text = MenuItemText;
// Override the menu item id for the clear crop
if (action == UIAction.ClearCrop) {
MenuItemId = UIAction.ClearCrop.ToString();
}
}
示例11: Start
// Use this for initialization
void Start () {
Cr = GetComponent<CanvasRenderer>();
Cr.SetAlpha(0);
ScaleBase = transform.localScale;
Invoke ("ShowSwitch",DelayTime);
}
示例12: Start
// Use this for initialization
void Start()
{
screenScale = transform.parent.GetComponent<RectTransform>().rect.size / 2;
rTrans = GetComponent<RectTransform>();
text = GetComponent<Text>();
rend = GetComponent<CanvasRenderer>();
if (transform.childCount > 0)
{
childTrans = transform.GetChild(0).GetComponent<RectTransform>();
childText = transform.GetChild(0).GetComponent<Text>();
childRend = transform.GetChild(0).GetComponent<CanvasRenderer>();
backImage = transform.parent.GetChild(0).GetComponent<Image>();
backRend = transform.parent.GetChild(0).GetComponent<CanvasRenderer>();
startScale = childTrans.localScale;
gameMan = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>();
plCol = gameMan.pColor[playerNum];
childText.color = plCol;
text.color = plCol;
backImage.color = plCol - (Color.white * .2f);
rend.SetAlpha(0);
childRend.SetAlpha(0);
backRend.SetAlpha(0);
}
}
示例13: FadeOut
IEnumerator FadeOut(CanvasRenderer graphic,float source = 1f, float time = 0.2f)
{
graphic.SetAlpha(source);
float t = time;
while (t > 0)
{
graphic.SetAlpha(Mathf.Lerp(source,0,1-(t/time)));
t -= Time.unscaledDeltaTime;
yield return null;
}
graphic.SetAlpha(0);
graphic.gameObject.SetActive(false);
}
示例14: FadeIn
IEnumerator FadeIn(CanvasRenderer graphic, float target = 1f, float time = 0.2f)
{
graphic.SetAlpha(0);
graphic.gameObject.SetActive(true);
float t = time;
while(t>0)
{
graphic.SetAlpha(Mathf.Lerp(0, target,1-(t/time)));
t -= Time.unscaledDeltaTime;
yield return null;
}
graphic.SetAlpha(target);
}
示例15: 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);
}