协同程序
来源:互联网 发布:seo顾问服务 编辑:程序博客网 时间:2024/05/21 22:40
using UnityEngine;
using System.Collections;
public class CorountineTest01 : MonoBehaviour {
// Use this for initialization
void Start () {
// //Debug.Log("Test Start");
////yield return StartCoroutine(Test());
// StartCoroutine(Test02(3));
// //Debug.Log("Test End");
//延迟3秒之后 执行方法Test03
Invoke("Test03",3);
InvokeRepeating("Test03", 0, 2);
}
// Update is called once per frame
void Update () {
}
IEnumerator Test02(int wave)
{
int count = 0;
while (count<wave)
{
count++;
yield return StartCoroutine(Test01(5));
if (count==1)
{
StopAllCoroutines();//break
}
Debug.Log("第" + count + "波怪产生结束");
yield return new WaitForSeconds(5);
Debug.Log("注意,下一波即将产生");
}
Debug.Log("游戏结束");
}
void Test03()
{
Debug.Log("InvokeTest");
}
IEnumerator Test01(int number)
{
//yield return new WaitForSeconds(2);
//Debug.Log("终于执行到了***");
//yield return new WaitForSeconds(3);
//Debug.Log("执行3秒");
//yield return new WaitForSeconds(4);
//Debug.Log("执行4秒");
//yield return new WaitForSeconds(5);
//Debug.Log("执行5秒");
int count = 0;
while (count<number)
{
count++;
yield return new WaitForSeconds(1);
Debug.Log("这是产生的第" + count + "个怪物");
}
}
}
using System.Collections;
public class CorountineTest01 : MonoBehaviour {
// Use this for initialization
void Start () {
// //Debug.Log("Test Start");
////yield return StartCoroutine(Test());
// StartCoroutine(Test02(3));
// //Debug.Log("Test End");
//延迟3秒之后 执行方法Test03
Invoke("Test03",3);
InvokeRepeating("Test03", 0, 2);
}
// Update is called once per frame
void Update () {
}
IEnumerator Test02(int wave)
{
int count = 0;
while (count<wave)
{
count++;
yield return StartCoroutine(Test01(5));
if (count==1)
{
StopAllCoroutines();//break
}
Debug.Log("第" + count + "波怪产生结束");
yield return new WaitForSeconds(5);
Debug.Log("注意,下一波即将产生");
}
Debug.Log("游戏结束");
}
void Test03()
{
Debug.Log("InvokeTest");
}
IEnumerator Test01(int number)
{
//yield return new WaitForSeconds(2);
//Debug.Log("终于执行到了***");
//yield return new WaitForSeconds(3);
//Debug.Log("执行3秒");
//yield return new WaitForSeconds(4);
//Debug.Log("执行4秒");
//yield return new WaitForSeconds(5);
//Debug.Log("执行5秒");
int count = 0;
while (count<number)
{
count++;
yield return new WaitForSeconds(1);
Debug.Log("这是产生的第" + count + "个怪物");
}
}
}
阅读全文
0 0
- 协同程序
- 协同程序
- 协同程序
- 协同程序
- Lua的协同程序
- 协同程序 过滤器
- Lua - Lua协同程序
- Lua的协同程序
- 8.协同程序
- unity协同程序
- unity IEnumerator 协同程序
- Unity3D协同程序
- Lua的协同程序
- 协同程序功能脚本
- Lua的协同程序
- lua协同程序
- Lua协同程序coroutine
- Unity Coroutine协同程序
- SQL中间表使用
- CodeForces 6C Alice, Bob and Chocolate
- ANDROID 实现布局动态加载
- curl 的post请求模拟登陆
- 【南阳理工】 46 最少乘法次数
- 协同程序
- java内部类
- Chrome浏览器账号无法登陆
- 蓝牙耳机录音进行讯飞语音识别
- 探究php底层运行机制
- 软件模式设计作业
- 【备忘】Java菜鸟到大牛学习路线之实战篇
- 关于TCP/IP五层的最通俗理解
- UVA