SetAlpha() private method

private SetAlpha ( float alpha ) : void
alpha float
return void
Esempio n. 1
0
 /// <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);
 }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     textRenderer = GetComponent<CanvasRenderer>();
     fadeTimeRemaining = fadeSec;
     state = DisplayState_e.FADE_IN;
     textRenderer.SetAlpha(0);
 }
Esempio n. 3
0
 void Awake()
 {
     _backgroundRenderer = gameObject.transform.Find("Background").GetComponent<CanvasRenderer>();
     _indicatorRenderer = gameObject.transform.Find("Indicator").GetComponent<CanvasRenderer>();
     _backgroundRenderer.SetAlpha(_currentAlpha);
     _indicatorRenderer.SetAlpha(_currentAlpha);
 }
Esempio n. 4
0
 static public int SetAlpha(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         self.SetAlpha(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Esempio n. 5
0
    // 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);
    }
Esempio n. 6
0
    // Use this for initialization
    void Awake()
    {
        textField = transform.Find("Text").gameObject.GetComponent<UnityEngine.UI.Text>();
        canvRenderer = GetComponent<CanvasRenderer>();
        canvRenderer.SetAlpha(0.0f);

        initCaptions ();
    }
    // 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);
    }
Esempio n. 8
0
#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;
	}
Esempio n. 9
0
 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);
 }
    // 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);
    }
Esempio n. 11
0
 static public int SetAlpha(IntPtr l)
 {
     try {
         UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         self.SetAlpha(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int SetAlpha(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.CanvasRenderer obj = (UnityEngine.CanvasRenderer)ToLua.CheckObject(L, 1, typeof(UnityEngine.CanvasRenderer));
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.SetAlpha(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    // 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();
        }
    }
Esempio n. 14
0
    // 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);
        }
    }
Esempio n. 15
0
    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);
    }
Esempio n. 16
0
 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);
 }
Esempio n. 17
0
	// Use this for initialization
	void Start () {
        Cr = GetComponent<CanvasRenderer>();
        Cr.SetAlpha(0);
		ScaleBase = transform.localScale;
		Invoke ("ShowSwitch",DelayTime);
	}
Esempio n. 18
0
    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);
    }