Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class RockPool : MonoBehaviour {
- static int numRocks = 1000;
- public GameObject rockPrefab;
- static GameObject[] rocks;
- void Start ()
- {
- //Setting array size to numRocks size
- rocks = new GameObject [numRocks];
- for (int i = 0; i < numRocks; i++)
- {
- rocks [i] = (GameObject) Instantiate(rockPrefab, Vector3.zero, Quaternion.identity);
- rocks [i].SetActive (false);
- }
- }
- static public GameObject getRock()
- {
- for (int i = 0; i < numRocks; i++)
- {
- if (!rocks [i].activeSelf)
- {
- return rocks [i];
- }
- }
- return null;
- }
- public void GenerateRocks()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement