/// <summary> /// Spawns a random object somewhere on the board. /// </summary> private void SpawnRandomObject() { PickUpPool pickUpPool = GetRandomPickUpPool(); GameObject nextPickUp = pickUpPool.objectPool.GetNextPooledObject(); SpawnObjectAtRandomLocation(nextPickUp); }
// Use this for initialization void Awake() { stackRef = GetComponent<difficultyStack> (); if(!GetComponent<trackManager>()) { managerRef = GameObject.Find ("GameManager"); if(GetComponent<trackManager>()) { if(GetComponent<trackManager>().enabled) inEditor = true; } if(playerRef==null) playerRef = GameObject.Find ("Skater"); nextSegmentPosition = GameObject.Find ("InitPart").GetComponent<trackPartData> ().endPoint.transform.position; segmentPoolRef = managerRef.GetComponent<trackSegmentPool> (); partPoolRef = managerRef.GetComponent<trackPartPool> (); pickUpPoolRef = managerRef.GetComponent<PickUpPool>(); backgroundRef = GetComponent<BackgroundSpawner>(); segmentPoolRef.loadSegments (); } }