浏览代码

Changed coroutine delays to not allocate every time

/main
mikegeig 4 年前
当前提交
a8221983
共有 1 个文件被更改,包括 11 次插入8 次删除
  1. 19
      DOTS_Pong/Assets/Scripts/GameManager.cs

19
DOTS_Pong/Assets/Scripts/GameManager.cs


Entity ballEntityPrefab;
EntityManager manager;
WaitForSeconds oneSecond;
WaitForSeconds delay;
private void Awake()
{
if (main != null && main != this)

main = this;
playerScores = new int[2];
manager = World.Active.EntityManager;
manager = World.DefaultGameObjectInjectionWorld.EntityManager;
oneSecond = new WaitForSeconds(1f);
delay = new WaitForSeconds(respawnDelay);
StartCoroutine(CountdownAndSpawnBall());
}

IEnumerator CountdownAndSpawnBall()
{
mainText.text = "Get Ready";
yield return new WaitForSeconds(respawnDelay);
yield return delay;
WaitForSeconds delay = new WaitForSeconds(1f);
yield return delay;
yield return oneSecond;
yield return delay;
yield return oneSecond;
yield return delay;
yield return oneSecond;
mainText.text = "";

正在加载...
取消
保存