private void PerformScheduledSpawning() { if (!this || !base.gameObject || !base.gameObject.activeInHierarchy || !this.HasBeenRebuilt) { return; } int num = 0; for (int i = 0; i < this.CountX; i++) { for (int j = 0; j < GreebleLayer.CountY; j++) { for (int k = 0; k < this.CountZ; k++) { if (this.greebles[i, j, k].IsSpawning) { this.InstantiateGreeble(i, j, k); num++; if (num >= 5) { WorkScheduler.RegisterOneShot(new WsTask(this.PerformScheduledSpawning)); return; } } } } } }
private void ScheduledSpawn() { if (!this.currentlyVisible) { return; } if (this.scheduledSpawnIndex < this.InstanceCount) { this.SpawnIndex(this.scheduledSpawnIndex); } this.scheduledSpawnIndex++; if (this.scheduledSpawnIndex < this.InstanceCount) { WorkScheduler.RegisterOneShot(new WorkScheduler.Task(this.ScheduledSpawn)); } }