crafting system is fully functional
This commit is contained in:
parent
63d4092c2c
commit
564f2a80cd
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BP_NPCControllerBase.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BP_NPCControllerBase.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BehaviorTree/BB_NPCBase.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BehaviorTree/BB_NPCBase.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BehaviorTree/BT_NPCBase.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BehaviorTree/BT_NPCBase.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BehaviorTree/E_NPCBehaviorStateBase.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/Character/NPC/BehaviorTree/E_NPCBehaviorStateBase.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Character/PlayerCharacter/BP_HYPlayerCharacController.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/Character/PlayerCharacter/BP_HYPlayerCharacController.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Illusions/GeneralizedBlueprints/ItemBP/ChildrenItemBP/BP_TeaCup.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/Hwanyoung/Illusions/GeneralizedBlueprints/ItemBP/ChildrenItemBP/BP_TeaCup.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Interactables/ItemDataTable.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/Interactables/ItemDataTable.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/Levels/Spring.umap
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/Levels/Spring.umap
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Crafting_HUD/BP_CookingHUDWidget.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/UI/Crafting_HUD/BP_CookingHUDWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Crafting_HUD/BP_CraftingHUDWidget.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/UI/Crafting_HUD/BP_CraftingHUDWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Crafting_HUD/BP_CraftingItemSlot.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/UI/Crafting_HUD/BP_CraftingItemSlot.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Inventory_HUD/BP_InventoryHUDWidget.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/UI/Inventory_HUD/BP_InventoryHUDWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Inventory_HUD/BP_InventoryItemToolTip.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/UI/Inventory_HUD/BP_InventoryItemToolTip.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/Hwanyoung/UI/Player_HUD/WG_PlayerHUD.uasset
(Stored with Git LFS)
BIN
hwanyoung2/Content/Hwanyoung/UI/Player_HUD/WG_PlayerHUD.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
hwanyoung2/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/5/5T/WBIWIME71FMAJC5DG8LPM0.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/5/5T/WBIWIME71FMAJC5DG8LPM0.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hwanyoung2/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/SO/DVS50SZGH8WN6RAKBQRMQR.uasset
(Stored with Git LFS)
Normal file
BIN
hwanyoung2/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/SO/DVS50SZGH8WN6RAKBQRMQR.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -39,9 +39,9 @@ bool AHYPlayerCharacController::AddItemToInventoryByID(FName ID)
|
||||
return false;
|
||||
}
|
||||
|
||||
void AHYPlayerCharacController::CraftItem(FInventoryItem ItemA, FInventoryItem ItemB, FInventoryItem ItemC, FInventoryItem ItemD)
|
||||
void AHYPlayerCharacController::CraftItem(FInventoryItem ItemA)
|
||||
{
|
||||
for (auto Combination : ItemB.CraftCombinations) {
|
||||
/*for (auto Combination : ItemB.CraftCombinations) {
|
||||
if (Combination.ItemAID == ItemA.ItemID
|
||||
&& Combination.ItemBID == ItemB.ItemID
|
||||
&& Combination.ItemCID == ItemC.ItemID
|
||||
@ -53,7 +53,38 @@ void AHYPlayerCharacController::CraftItem(FInventoryItem ItemA, FInventoryItem I
|
||||
AddItemToInventoryByID(Combination.ProductID);
|
||||
ReloadCraftUI();
|
||||
}
|
||||
}*/
|
||||
|
||||
int32 NumOfCraftingItems = CraftingItems.Num();
|
||||
bool bIsValidComb;
|
||||
bIsValidComb = false;
|
||||
if (NumOfCraftingItems < 2 || NumOfCraftingItems > 4) { return; }
|
||||
|
||||
AHYGameStateBase* gameState = Cast<AHYGameStateBase>(GetWorld()->GetGameState());
|
||||
UDataTable* itemDB = gameState->GetItemDatabase();
|
||||
|
||||
for (auto Combination : ItemA.CraftCombinations) {
|
||||
if (CraftingItems.Contains(Combination.ItemBID) && NumOfCraftingItems >= 2) {
|
||||
if (Combination.bDestroyItemB) Inventory.RemoveSingle(*itemDB->FindRow<FInventoryItem>(Combination.ItemBID, ""));
|
||||
bIsValidComb = bIsValidComb || true;
|
||||
}
|
||||
if (CraftingItems.Contains(Combination.ItemCID) && NumOfCraftingItems >= 3) {
|
||||
if (Combination.bDestroyItemC) Inventory.RemoveSingle(*itemDB->FindRow<FInventoryItem>(Combination.ItemCID, ""));
|
||||
bIsValidComb = bIsValidComb && true;
|
||||
}
|
||||
if (CraftingItems.Contains(Combination.ItemDID) && NumOfCraftingItems == 4) {
|
||||
if (Combination.bDestroyItemD) Inventory.RemoveSingle(*itemDB->FindRow<FInventoryItem>(Combination.ItemDID, ""));
|
||||
bIsValidComb = bIsValidComb && true;
|
||||
}
|
||||
if (bIsValidComb) {
|
||||
if (Combination.bDestroyItemA) Inventory.RemoveSingle(ItemA);
|
||||
AddItemToInventoryByID(Combination.ProductID);
|
||||
ReloadCraftUI();
|
||||
return;
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AHYPlayerCharacController::Interact()
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
bool AddItemToInventoryByID(FName ID);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Utils")
|
||||
void CraftItem(FInventoryItem ItemA, FInventoryItem ItemB, FInventoryItem ItemC, FInventoryItem ItemD);
|
||||
void CraftItem(FInventoryItem ItemA);
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
|
||||
class AHYInteractableActor* CurrentInteractable;
|
||||
@ -55,6 +55,10 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 Currency;
|
||||
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
TSet<FName> CraftingItems;
|
||||
|
||||
//interacts with the Interactable objects
|
||||
UFUNCTION(BlueprintCallable, Category = "Utils")
|
||||
void Interact();
|
||||
|
@ -62,4 +62,10 @@ public:
|
||||
bool operator==(const FInventoryItem& OtherItem) const {
|
||||
return ItemID == OtherItem.ItemID;
|
||||
}
|
||||
|
||||
friend uint32 GetTypeHash(const FInventoryItem& InventoryItem) {
|
||||
|
||||
return HashCombine(GetTypeHash(InventoryItem.ItemID), InventoryItem.ItemValue);
|
||||
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user