Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class Notice : Text {
- float showTime;
- float lerpSpeed;
- bool isHide;
- void Update() {
- if(isHide) {
- color = Color.Lerp(color, new Color(color.r, color.g, color.b, 0), lerpSpeed * Time.deltaTime);
- }
- }
- public void Output(string noticeText, Color noticeColor, float showTime, float lerpSpeed) {
- text = noticeText;
- color = noticeColor;
- this.showTime = showTime;
- this.lerpSpeed = lerpSpeed;
- StartCoroutine(Hide());
- }
- IEnumerator Hide() {
- isHide = false;
- yield return new WaitForSeconds(showTime);
- isHide = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement