123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System.Collections;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class SkipAndLoad : MonoBehaviour
- {
- [SerializeField]
- private UIButton _skip;
- [SerializeField]
- private UISprite _progres;
- private AsyncOperation _async;
- void Start ()
- {
- //_skip.onClick.Add(new EventDelegate(Skip));
- Show();
- }
- private void Update()
- {
- //if (_async != null)
- //{
- // _progres.fillAmount = _async.progress;
- //}
- }
- public void Show()
- {
- StartCoroutine(_routine());
- //_progres.transform.parent.gameObject.SetActive(false);
- //_skip.gameObject.SetActive(true);
- }
- private IEnumerator _routine()
- {
- yield return new WaitForSeconds(5);
- Load();
- }
- private void Skip()
- {
- Load();
- }
- private void Load()
- {
- //if (!_skip.gameObject.activeSelf)
- //{
- // return;
- //}
- //_skip.gameObject.SetActive(false);
- StartCoroutine(_show());
- }
- private IEnumerator _show()
- {
- //_progres.transform.parent.gameObject.SetActive(true);
- //_skip.gameObject.SetActive(false);
- _async = SceneManager.LoadSceneAsync("Runner");
- yield return _async;
- }
- }
|