public override void DoAction(PlayerCharacter character, Selectable select) { PlayerData pdata = PlayerData.Get(); Construction construction = select.GetComponent <Construction>(); if (construction != null) { ItemData take_item = construction.data.take_item_data; InventoryData inv_data = character.Inventory.GetValidInventory(take_item, 1); if (take_item != null && inv_data != null) { BuiltConstructionData bdata = pdata.GetConstructed(construction.GetUID()); float durability = bdata != null ? bdata.durability : take_item.durability; inv_data.AddItem(take_item.id, 1, durability, select.GetUID()); select.Destroy(); } } Character acharacter = select.GetComponent <Character>(); if (acharacter != null) { ItemData take_item = acharacter.data.take_item_data; InventoryData inv_data = character.Inventory.GetValidInventory(take_item, 1); if (take_item != null && inv_data != null) { TrainedCharacterData cdata = pdata.GetCharacter(acharacter.GetUID()); inv_data.AddItem(take_item.id, 1, take_item.durability, select.GetUID()); select.Destroy(); } } }
private void OnUse(PlayerCharacter player) { if (!string.IsNullOrEmpty(select.GetUID())) { MixingPanel.Get().ShowMixing(player, this, select.GetUID()); } else { Debug.LogError("You must generate the UID to use the mixing pot feature."); } }
void Update() { ItemSlotPanel chest_panel = ItemSlotPanel.Get(select.GetUID()); bool open = chest_panel != null && chest_panel.IsVisible(); Quaternion target = open ? Quaternion.Euler(-90f, 0f, 0f) * start_rot : start_rot; chest_lid.localRotation = Quaternion.Slerp(chest_lid.localRotation, target, 10f * Time.deltaTime); if (chest_lid_outline != null) { chest_lid_outline.localRotation = Quaternion.Slerp(chest_lid_outline.localRotation, target, 10f * Time.deltaTime); } }