Example #1
0
 IEnumerator Execute(ModuleWorker worker)
 {
     worker.Restart();
     yield return new WaitForSeconds(delay);
     while (GameWorld.Instance.IsPaused) yield return null;
     if (prefab != null)
     {
         worker.ProcessNext(Instantiate(prefab, worker.source.transform.position, Quaternion.AngleAxis(Random.Range(0, 360f), Vector3.up)) as Entity);
     }
 }
Example #2
0
 IEnumerator Execute(ModuleWorker worker)
 {
     if (started) { yield break; }
     started = true;
     yield return new WaitForSeconds(delay);
     RESTART:
     if (prefab == null) { Debug.LogError("human prefab not assigned"); yield break; }
     if (worker.markedForDeletion) { yield break; }
     while (GameWorld.Instance.IsPaused) yield return null;
     worker.Restart();
     worker.ProcessNext(Instantiate(prefab, worker.source.transform.position, Quaternion.AngleAxis(Random.Range(0, 360f), Vector3.up)) as Entity);
     yield return new WaitForSeconds(timeInterval);
     goto RESTART;
 }
Example #3
0
 IEnumerator Execute(ModuleWorker worker)
 {
     yield return new WaitForSeconds(delay);
     float partTime = timeSpan / Mathf.Max(1f, amount);
     for (int i = 0; i < amount; i++)
     {
         if (worker.markedForDeletion) { yield break; }
         while (GameWorld.Instance.IsPaused) yield return null;
         if (prefab != null)
         {
             Entity e = Instantiate(prefab, worker.source.transform.position, Quaternion.AngleAxis(Random.Range(0, 360f), Vector3.up)) as Entity;
             e.name = e.GetInstanceID().ToString();
             worker.ProcessNext(e);
         }
         yield return new WaitForSeconds(partTime);
         worker.Restart();
     }
 }