public Bar GetNextBar() { Bar nextBar = preparedBars.Dequeue(); nextBar.Prepare(ProceduralPathGenerator.GetBarData(ScoreKeeper.Score)); activeBars.Enqueue(nextBar); return(nextBar); }
public void RecycleBars() { if (preparedBars.Count >= minimumNumberOfPreparedBars) { return; } float yPos = preparedBars.Last().transform.localPosition.y + 2; Bar bottomBar = activeBars.Dequeue(); bottomBar.SetYPosition(yPos); bottomBar.Prepare(ProceduralPathGenerator.GetBarData(ScoreKeeper.Score)); preparedBars.Enqueue(bottomBar); }