当前位置: 首页>>代码示例>>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;未经允许,请勿转载。