1 //委托的定义 2 public delegate IEnumerator ActiveDuringTurn(Player[] otherplayers); 3 4 public event ActiveDuringTurn UEvent; 5 6 7 //依次启动协程 8 foreach (ActiveDuringTurn active in UEvent.GetInvocationList()) 9 { 10 yield return StartCoroutine(active.Invoke(otherPlayers)); 11 }
用GetInvocationList()方法拿到委托中的所有方法,然后依次yield return StartCoroutine(...)它们,就可以实现协程依次执行的效果了
(别忘了yield return得放在返回值为IEnumeartor的函数里运行)
标签:多播,协程,委托,ActiveDuringTurn,yield,依次,return From: https://www.cnblogs.com/commend-sheep/p/17157325.html