- using UnityEngine;
- using System.Collections;
- public class FightTriggle : MonoBehaviour {
- private AsyncOperation async;
- int i = 0;
- void OnTriggerEnter(Collider other)
- {
- Debug.Log("打開");
- if (other.collider.gameObject.tag == "Player")
- {
- //打開副本UI
- Debug.Log("打開副本");
- StartCoroutine(GetProgress());
- }
- }
- IEnumerator GetProgress()
- {
- async = Application.LoadLevelAsync(0);
- yield return async;
- }
- void Update()
- {
- if (async != null)
- {
- if (!async.isDone)
- {
- float progress = async.progress;
- Debug.Log("加載進度 " + async.progress);
- i++;
- Debug.Log("" + i+async.progress);
- }
- }
- }
- void OnTriggerExit(Collider other)
- {
- if (other.collider.gameObject.tag == "Player")
- {
- Debug.Log("關才副本");
- }
- }
- }