當前位置: 首頁>>代碼示例>>C#>>正文


C# CanvasRenderer.SetAlpha方法代碼示例

本文整理匯總了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);
 }
開發者ID:gjrfytn,項目名稱:planet-survival,代碼行數:16,代碼來源:RenderHelper.cs

示例2: Start

 // Use this for initialization
 void Start()
 {
     textRenderer = GetComponent<CanvasRenderer>();
     fadeTimeRemaining = fadeSec;
     state = DisplayState_e.FADE_IN;
     textRenderer.SetAlpha(0);
 }
開發者ID:spencewenski,項目名稱:Vision,代碼行數:8,代碼來源:TriggerText.cs

示例3: Awake

 void Awake()
 {
     _backgroundRenderer = gameObject.transform.Find("Background").GetComponent<CanvasRenderer>();
     _indicatorRenderer = gameObject.transform.Find("Indicator").GetComponent<CanvasRenderer>();
     _backgroundRenderer.SetAlpha(_currentAlpha);
     _indicatorRenderer.SetAlpha(_currentAlpha);
 }
開發者ID:revisual,項目名稱:Pipit-Unity,代碼行數:7,代碼來源:FadeProgress.cs

示例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 ();
    }
開發者ID:monsieurplus,項目名稱:Ylla,代碼行數:9,代碼來源:Subtitles_Scripting.cs

示例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);
    }
開發者ID:DonRobo,項目名稱:satanic-buddies,代碼行數:9,代碼來源:HUDScript.cs

示例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);
    }
開發者ID:Auranapse,項目名稱:Scrubity-UI,代碼行數:11,代碼來源:initUISettingsScreen.cs

示例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;
	}
開發者ID:J-Dodds,項目名稱:CanyonRun,代碼行數:11,代碼來源:UI_LaunchButton.cs

示例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);
 }
開發者ID:gjrfytn,項目名稱:planet-survival,代碼行數:10,代碼來源:Fader.cs

示例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);
    }
開發者ID:Auranapse,項目名稱:Scrubity-UI,代碼行數:12,代碼來源:initCTRLSettingsScreen.cs

示例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();
        }
    }
開發者ID:J-Dodds,項目名稱:SimpleFarmingGame,代碼行數:16,代碼來源:UI_CropsMenuItem.cs

示例11: Start

	// Use this for initialization
	void Start () {
        Cr = GetComponent<CanvasRenderer>();
        Cr.SetAlpha(0);
		ScaleBase = transform.localScale;
		Invoke ("ShowSwitch",DelayTime);
	}
開發者ID:BushiRhythm,項目名稱:BushiRhythm,代碼行數:7,代碼來源:ResultDataShow.cs

示例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);
        }
    }
開發者ID:izzy-sabur,項目名稱:polish_proj,代碼行數:29,代碼來源:NiceText.cs

示例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);
    }
開發者ID:tuyasa,項目名稱:ggj2016,代碼行數:15,代碼來源:Manager.cs

示例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);
    }
開發者ID:tuyasa,項目名稱:ggj2016,代碼行數:15,代碼來源:Manager.cs

示例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);
 }
開發者ID:gjrfytn,項目名稱:planet-survival,代碼行數:10,代碼來源:Fader.cs


注:本文中的UnityEngine.CanvasRenderer.SetAlpha方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。