Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class EnvironmentSpawner : MonoBehaviour {
- public GameObject LargeCloud;
- void Start() {
- StartCoroutine(SpawnLargeClouds());
- }
- void HaltSpawning() {
- StopCoroutine(SpawnLargeClouds());
- }
- IEnumerator SpawnLargeClouds() {
- yield return new WaitForSeconds(3);
- while(true) {
- var largeCloud = GameObjectPooler.Instance.GetObject(LargeCloud);
- largeCloud.transform.position = new Vector3(0.98f, 5.68f, -0f);
- largeCloud.transform.rotation = Quaternion.identity;
- largeCloud.SetActive(true);
- yield return new WaitForSeconds(3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement