110,535
社区成员
发帖
与我相关
我的任务
分享
public float roundIntervalTime = 3f;
public float spawIntervalTime = 1f;
IEnumerator RunRound()
{
if (isPause)
{
yield return null;
//有什么办法暂停
}
//SpawnMonsterArgs e = new SpawnMonsterArgs();
for (int r = 0; r < lstRound.Count; r++)
{
//这里可以加入StartRound事件,例如可触发最后一波
roundIndex = r;
for (int i = 0; i < lstRound[r].monsterCount; i++)
{
//e.monsterID = lstRound[r].monsterID;
//SendEvent(Consts.E_SpawnMonster, e);
if (r == (lstRound.Count - 1) && (i == lstRound[r].monsterCount - 1))
{
Debug.Log(" round is end !");
}
else
{
Debug.Log("Round: r:" + r + ", i:" + i);
}
yield return new WaitForSeconds(spawIntervalTime);
}
yield return new WaitForSeconds(roundIntervalTime);
}
}
public void StartRound()
{
coroutine= Game.Instance.StartCoroutine(RunRound());
Debug.Log("RoundModel.StartRound()");
}
public void StopRound()
{
//Game.Instance.StopCoroutine(coroutine);
isPause = !isPause;
Debug.Log("isPause: "+isPause);
}