Advertisement
Lucky134Lucky

Untitled

Jan 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class CongratulatonsScript : MonoBehaviour {
  6.  
  7. List<GameObject> eventsList = new List<GameObject>();
  8. void Start () {
  9. StartCoroutine(FadeTo(0.0f, 1.0f));
  10. }
  11.  
  12. // Update is called once per frame
  13. void Update () {
  14. }
  15. IEnumerator FadeTo(float aValue, float aTime)
  16. {
  17. GameObject strin = eventsList[0];
  18. float alpha = GetComponent<Text>().material.color.a;
  19.  
  20. Material material = GetComponent<Text>().material;
  21.  
  22. for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime)
  23. {
  24. Color newColor = new Color(material.color.r, material.color.g, material.color.b, Mathf.Lerp(alpha, 0, t));
  25. GetComponent<Text>().material.color = newColor;
  26. transform.Translate(Vector3.up * t * 2);
  27. yield return null;
  28. }
  29.  
  30. // yield return new WaitForSeconds((float)0.5);
  31.  
  32. // for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime)
  33. // {
  34. // Color newColor = new Color(material.color.r, material.color.g, material.color.b, Mathf.Lerp(alpha, 0, t));
  35. // GetComponent<Text>().material.color = newColor;
  36. // transform.Translate(Vector3.up * t * 2);
  37. // yield return null;
  38. // }
  39. }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement