Example #1
0
    private void Awake()
    {
        gameOverPanel.GetComponent <CanvasRenderer>().SetAlpha(0.0f);
        foreach (Text text in gameOverPanel.GetComponentsInChildren <Text>())
        {
            text.CrossFadeAlpha(0.0f, 0.0f, false);
        }
        tryAgainButton.enabled = false;
        tryAgainButton.GetComponent <CanvasRenderer>().SetAlpha(0.0f);
        tryAgainButton.GetComponentInChildren <Text>().GetComponent <CanvasRenderer>().SetAlpha(0.0f);
        tryAgainButton.onClick.AddListener(TryAgain);

        source = GetComponent <AudioSource>();
    }
Example #2
0
    static public void SetCanvasRenderAlphaWithChildren(ref CanvasRenderer _canvasRender, float _a)
    {
//		List<CanvasRenderer> canvasRenders = new List<CanvasRenderer> ();
//		_canvasRender.GetComponentsInChildren<CanvasRenderer> (canvasRenders);
        CanvasRenderer[] canvasRenders = _canvasRender.GetComponentsInChildren <CanvasRenderer> ();
        foreach (CanvasRenderer c in canvasRenders)
        {
            c.SetAlpha(_a);
        }
    }
 /**
  * Generates the UI from prefab panels
  */
 private void BuildUI()
 {
     foreach (CanvasRenderer cr in PrefabManager.prefabManager.panels)
     {
         CanvasRenderer temp  = Instantiate(cr, cr.transform.position, Quaternion.identity) as CanvasRenderer;
         Text[]         texts = temp.GetComponentsInChildren <Text>();
         foreach (Text t in texts)
         {
             t.font = (Font)Resources.Load("Font/Candara");
         }
         temp.transform.SetParent(this.transform, false);
     }
 }