void Roll() { Payout payout = rng.GetRandomChanceObject(payouts.Cast <IChanceObject <Payout> >().ToList()); if (payout.type == Payout.Type.none) { cost += cost_growth; cost_text.text = "$" + cost; } else if (payout.type == Payout.Type.item) { ItemPedastal new_item = Instantiate(pedastal); new_item.transform.position = chest_spawn_point.position; new_item.SetItem(ItemListSingleton.instance.GetRandomItem(RNGSingleton.instance.random_item_rng), true); PaidOut(); } else if (payout.type == Payout.Type.pickups) { Utilities.Utilities.ThrowObjects(payout.pickups_to_spawn, pickup_spawn_point); PaidOut(); } }
public Item AddItem(Item i, bool will_handle_old_item) { Item replaced_item = null; if (i.item_type == Item.Type.active) { replaced_item = active_item; active_item = i as ActiveItem; player.player_display.SetActiveItemDisplay(active_item.active_ability); if (replaced_item) { replaced_item.OnDrop(player); if (!will_handle_old_item) { ItemPedastal new_pedastal = Instantiate(replaced_item_pedastal); new_pedastal.transform.position = player.transform.position; new_pedastal.SetItem(replaced_item, false); } } } else { if (items_in_inventory.ContainsKey(i.item_name)) { Destroy(i.gameObject); i = items_in_inventory[i.item_name]; } else { items_in_inventory.Add(i.item_name, i); } } i.OnPickup(player); on_collect_item?.Invoke(i); return(replaced_item); }