the player can pick up consumable items and use items for different effects; needs optimization in player character base BP class

This commit is contained in:
Ji Yoon Rhee
2024-08-27 14:29:55 +09:00
parent e8cacbe1c7
commit 682231dd0f
470 changed files with 1400 additions and 44 deletions

View File

@ -39,6 +39,18 @@ bool AHYPlayerCharacController::AddItemToInventoryByID(FName ID)
return false;
}
void AHYPlayerCharacController::CraftItem(FInventoryItem ItemA, FInventoryItem ItemB)
{
for (auto Pair : ItemB.CraftCombinations) {
if (Pair.ComponentID == ItemA.ItemID) {
if (Pair.bDestroyItemA) Inventory.RemoveSingle(ItemA);
if (Pair.bDestroyItemB) Inventory.RemoveSingle(ItemB);
AddItemToInventoryByID(Pair.ProductID);
ReloadCraftUI();
}
}
}
void AHYPlayerCharacController::Interact()
{
if (CurrentInteractable) CurrentInteractable->Interact(this);