Esempio n. 1
0
 private void BuildPoolQueue()
 {
     for (int i = 0; i < 20; i++)
     {
         GameObject t = MakeSegment();
         pool.Enqueue(t);
     }
 }
Esempio n. 2
0
    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);
    }