public override bool InstantExecute(GameObject target, IAction[] actions, int index) { if (this.lootTable == null) { return(true); } LootTable.LootResult loot = this.lootTable.Get(); if (loot.item != null && loot.amount > 0) { switch (this.target) { case Target.PlayerInventory: InventoryManager.Instance.AddItemToInventory( loot.item.uuid, loot.amount ); break; case Target.Container: Container containerInstance = this.container.GetComponent <Container>(target); if (containerInstance != null) { containerInstance.AddItem( loot.item.uuid, loot.amount ); } break; } } return(true); }
private void OnUseLootTable(LootTable.LootResult result) { string itemName = result.item.itemName.GetText(); float itemAmount = result.amount; this.storeItemName.Set(itemName, gameObject); this.storeItemAmount.Set(itemAmount, gameObject); this.ExecuteTrigger(gameObject); }