void Update()
 {
     if (state == 1)
     {
         if (thisRect.position.y < onPos.y)
         {
             tempVec2          = thisRect.position;
             tempVec2.y        = Mathf.Lerp(tempVec2.y, onPos.y * 1.01f, Time.deltaTime * animSpeed);
             thisRect.position = tempVec2;
             canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, 1.01f, Time.deltaTime * animSpeed);
         }
         else
         {
             thisRect.position = onPos;
             // Avoid update from repeating this loop while waiting
             state = 0;
             StartCoroutine(WaitTime());
         }
     }
     else if (state == 2)
     {
         if (thisRect.position.y > offPos.y)
         {
             tempVec2          = thisRect.position;
             tempVec2.y        = Mathf.Lerp(tempVec2.y, offPos.y * 0.99f, Time.deltaTime * animSpeed);
             thisRect.position = tempVec2;
             canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, -0.01f, Time.deltaTime * animSpeed);
         }
         else
         {
             ToastControl.RemoveLastToast();
             Destroy(gameObject);
         }
     }
 }
Example #2
0
 public void PopupToast()
 {
     ToastControl.toastText       = text;
     ToastControl.toastDuration   = duration;
     ToastControl.toastPanelColor = panelColor;
     ToastControl.toastTextColor  = textColor;
     ToastControl.toastFontSize   = fontSize;
     if (ToastControl.toastPrefab != null)
     {
         GameObject toast = Instantiate(ToastControl.toastPrefab) as GameObject;
         ToastControl.AddToast(toast);
     }
 }
Example #3
0
 public void PopupToast()
 {
     ToastControl.MakeToast(text, duration, panelColor, textColor, fontSize);
 }
Example #4
0
 void Start()
 {
     ToastControl.InitToastSystem(gameObject.GetComponentInParent <Canvas>());
 }