Advertisement
Guest User

Untitled

a guest
May 5th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class EnvironmentSpawner : MonoBehaviour {
  5.  
  6. public GameObject LargeCloud;
  7.  
  8. void Start() {
  9. StartCoroutine(SpawnLargeClouds());
  10. }
  11.  
  12. void HaltSpawning() {
  13. StopCoroutine(SpawnLargeClouds());
  14. }
  15.  
  16. IEnumerator SpawnLargeClouds() {
  17. yield return new WaitForSeconds(3);
  18. while(true) {
  19. var largeCloud = GameObjectPooler.Instance.GetObject(LargeCloud);
  20. largeCloud.transform.position = new Vector3(0.98f, 5.68f, -0f);
  21. largeCloud.transform.rotation = Quaternion.identity;
  22. largeCloud.SetActive(true);
  23. yield return new WaitForSeconds(3);
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement