Unity 利用协同程序实现场景…
2014-10-21 14:49
483 查看
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("关才副本");
}
}
}
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("关才副本");
}
}
}
相关文章推荐
- Unity 利用协同程序实现场景切换时加载进度的监控
- Unity 利用协同程序实现场景切换时加载进度的监控
- unity场景加载,及协同程序
- 利用"NOTIFYICONDATA"实现MFC的托盘程序
- 利用"NOTIFYICONDATA"实现MFC的托盘程序
- Unity3D——利用协同程序实现游戏中的AI(自动行走和发现目标)
- EA&UML日拱一卒-微信小程序实战:位置闹铃 (9)-利用条件渲染实现列表控件
- Windows C 程序实现双缓冲
- 利用@media screen实现网页布…
- Unity C#脚本实现的相机漫游…
- 【Unity&DragonBones】实现不同身体部位协同动作(一)
- Unity&网络:利用UDP实现动态监测局域网在线用户及掉线事件。
- 【Unity&DragonBones】实现不同身体部位协同动作(二)
- 兴趣学习: opencv 实现画图程序
- 利用UIWebView 5行代码实现…
- 利用HttpModuler实现WEB程序同一时间只让一个用户实例登陆
- 建立第一个directX程序——在C#下利用DirectSound实现声音播放
- ASP小偷程序如何利用XMLHTTP实现表单的提交
- 如何利用C++ Builder 5.0 实现屏幕保护程序的开发
- asp小偷程序如何利用xmlhttp实现表单的提交以及cookies或session的发送