void ApplyAbilities(GrandHeist heist, Robber robber) { foreach (var ability in heist.Abilities) { robber.AddAbility(ability); } if (heist.RandomAbilitiesToAddToEachRobber.Max > 0) { var abilities = RefManager.AbilityFactory.GetRobberAbilities( robber.AbilityPrerequisites, heist.RandomAbilitiesToAddToEachRobber.RandomInt); foreach (var ability in abilities) { robber.AddAbility(ability); } } }
public void SpawnNext() { if (_currentHeistIndex == _heists.Length - 1) { print("Final wave. Pause all income, prevent build mode etc???"); } GrandHeist heist = _heists[_currentHeistIndex]; var spawnCurrency = heist.AdditionalSpawnCurrency; List <Robber> robbersToSpawn = new List <Robber>(); foreach (var rd in heist.RobbersInHeist) { var robber = _factory.BuildRobber(rd); ApplyAbilities(heist, robber); robbersToSpawn.Add(robber); } while (spawnCurrency > 0) { Robber robber = _factory.BuildRandomRobber(spawnCurrency); if (robber == null) { break; } spawnCurrency -= robber.SpawnCost; ApplyAbilities(heist, robber); robbersToSpawn.Add(robber); } // Trigger heist animation // On heist animation end _spawnController.SpawnGroup(robbersToSpawn); _currentHeistIndex++; }