public WaveCountSet GenerateScoreWave(int maxScore) { float multiplier = 1.0f; int availableScore = Mathf.Min(maxScore, maxDifficultyCutOff); List <ScoreAwarder> chosen = new List <ScoreAwarder>(); List <ScoreAwarder> possibleEnemies = new List <ScoreAwarder>(); possibleEnemies.AddRange(enemies); Predicate <ScoreAwarder> checkScore = (ScoreAwarder awarder) => { return(awarder.Score * multiplier <= availableScore); }; possibleEnemies = UpdateScoreList(possibleEnemies, checkScore); while (possibleEnemies.Count > 0) { multiplier = EvaluateIntCurve(DifficultyMultiplierPerEnemy, chosen.Count + 1); ScoreAwarder chosenAwarder = possibleEnemies[TimedBoundRandom.RandomInt(0, possibleEnemies.Count)]; chosen.Add(chosenAwarder); availableScore -= (int)(chosenAwarder.Score * multiplier); possibleEnemies = UpdateScoreList(possibleEnemies, checkScore); } return(new WaveCountSet(chosen.ToArray(), enemies)); }
private void InstantiateFromWaveList() { int index = TimedBoundRandom.RandomInt(0, waves.Waves.Length); Transform prefab = waves.Waves[index].transform; for (int i = 0; i < prefab.childCount; i++) { Transform childPrefab = prefab.GetChild(i); Instantiate(childPrefab, childPrefab.position, childPrefab.rotation); } }
private List <PickupRepresentation> PopulatePickup(RoundPickup pickup, List <PickupRepresentation> pickups) { if (pickups == null || pickups.Count <= 0) { return(pickups); } int chosenIndex = TimedBoundRandom.RandomInt(0, pickups.Count); PickupRepresentation representation = pickups[chosenIndex]; pickup.SetPlayerStats(representation.increments, representation.decrements, representation.image); pickup.topLabel = representation.topLabel; pickup.botLabel = representation.botLabel; pickups.RemoveAt(chosenIndex); return(pickups); }