1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using UnityEngine;
- using UnityEngine.UI;
- public class TextNotification : MonoBehaviour
- {
- [SerializeField]
- private Animator anim;
- [SerializeField]
- private Text message;
- [SerializeField]
- private Button closeBannerButton;
- [SerializeField]
- private float timeToHide = 4;
- public void Setup(string msg)
- {
- message.text = msg;
- }
- private void Update()
- {
- timeToHide -= Time.deltaTime;
- if(timeToHide <= 0)
- CloseNotification();
- }
- public void CloseNotification()
- {
- anim.SetBool("Hide", true);
- closeBannerButton.interactable = false;
- }
- public void Destroy()
- {
- Destroy(gameObject);
- }
- }
|