public static IEnumerable <BaseObject> CreateCollection(float startX, Lanes lanes, int count, float innerSpace) { List <BaseObject> coins = new List <BaseObject>(); if (count < 3) { return(coins); } float x = startX; //byte l = lanes.GetRandomLane(); //for (int i = 0; i < count; i++) //{ // coins[i] = new Coin(x, l); // x += innerSpace; //} //return coins; int sprint = count; if (count >= 6) { if (count <= 9) { sprint = EndlessLevelGenerator.random.Next(3, count); } else { sprint = EndlessLevelGenerator.random.Next(3, count - 3); } } byte lane = lanes.GetRandomLane(); for (int i = 0; i < sprint; i++) { if (lane > 0) { coins.Add(new Coin(x, lane)); } x += innerSpace; } lane = lanes.GetRandomLane(); for (int i = sprint; i < count; i++) { if (lane > 0) { coins.Add(new Coin(x, lane)); } x += innerSpace; } return(coins); }