public void SpawnBeat() { int beatCount = RandomQueue.GetRandomInt(LaneSpawnPoints.Count + 1); int firstBarState = RandomQueue.GetRandomInt(BarSideCount); List <int> AvailableLanes = new List <int>(LaneSpawnPoints.Count); List <int> ChosenLanes = new List <int>(); for (int i = 0; i < LaneSpawnPoints.Count; i++) { AvailableLanes.Add(i); } for (int a = beatCount; a > 0; a--) { int index = RandomQueue.GetRandomInt(AvailableLanes.Count); int laneChoice = AvailableLanes[index]; ChosenLanes.Add(laneChoice); AvailableLanes.RemoveAt(index); } ChosenLanes.Sort(); for (int x = 0; x < beatCount; x++) { Beat b = new Beat(Game, LaneSpawnPoints[ChosenLanes[x]]); b.Initialize(); b.State = GetStateFromInt((firstBarState + (ChosenLanes[x] - ChosenLanes[0])) % BarSideCount); beatsRowID.Add(b, ChosenLanes[x]); } }
void ChooseRowToSpawn() { int choice = RandomQueue.GetRandomInt(Rows.Count); Rows.ElementAt(choice).Value.RequestSpawn(); }