Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class UIAnimController : MonoBehaviour {
- public float animationTime;
- public GameObject ui;
- // Use this for initialization
- void Start () {
- ui.SetActive (false);
- }
- // Update is called once per frame
- void Update () {
- }
- public void StartAnimation(string _message)
- {
- ui.SetActive (true);
- ui.GetComponentInChildren<Text> ().text = _message;
- ui.GetComponent<Animator> ().SetBool ("startAnim", ui.activeSelf);
- StartCoroutine("EndAnimation");
- }
- private IEnumerator EndAnimation(){
- yield return new WaitForSeconds(animationTime);
- ui.GetComponent<Animator> ().SetBool ("startAnim", false);
- ui.SetActive (false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement