Guest User

Notice.cs

a guest
Jul 31st, 2015
193
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class Notice : Text {
  6.     float showTime;
  7.     float lerpSpeed;   
  8.     bool isHide;
  9.    
  10.     void Update() {
  11.         if(isHide) {
  12.             color = Color.Lerp(color, new Color(color.r, color.g, color.b, 0), lerpSpeed * Time.deltaTime);
  13.         }
  14.     }
  15.    
  16.     public void Output(string noticeText, Color noticeColor, float showTime, float lerpSpeed) {
  17.         text = noticeText;
  18.         color = noticeColor;
  19.         this.showTime = showTime;
  20.         this.lerpSpeed = lerpSpeed;
  21.         StartCoroutine(Hide());
  22.     }
  23.    
  24.     IEnumerator Hide() {
  25.         isHide = false;
  26.         yield return new WaitForSeconds(showTime);
  27.         isHide = true;
  28.     }
  29. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×