private void BuildPoolQueue() { for (int i = 0; i < 20; i++) { GameObject t = MakeSegment(); pool.Enqueue(t); } }
public GameObject ActivateSegment() { GameObject go = (pool.Count > 0) ? pool.Dequeue() : MakeSegment(); spawned.Enqueue(go); segmentBehavior.ActivateSegment(go, this); var t = go.transform.localPosition; t.y = -100; go.transform.localPosition = t; return(go); }