public void CreatePickups(ILootDropper lootDropper) { List <IPickup> possiblePickups = lootDropper.GetPickups(); float currentLootValueTotal = lootDropper.GetChallengeRating() * HostHandler.I.currentHost.lootValueMultiplier; bool canAfford = true; while (canAfford) { canAfford = false; if (possiblePickups.Count == 0) { continue; } IPickup pickup = possiblePickups[UnityEngine.Random.Range(0, possiblePickups.Count)]; if (pickup.GetLootValue() > currentLootValueTotal) { continue; } canAfford = true; currentLootValueTotal -= pickup.GetLootValue(); possiblePickups.Remove(pickup); CreatePickup(lootDropper.GetTransform().parent, pickup); } }
public void DropLoot(ILootDropper lootDropper) { lootDropper.onLootDrop.Invoke(lootDropper); CreatePickups(lootDropper); }
public void InitLootDropper(ILootDropper lootDropper) { lootDropper.onLootDrop = new LootDropEvent(); }