diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index 1319aac..737ca7e 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f4053e0c2b706222529424465ec20fd601bfb76e77887ee6192cf432085cbcc -size 53377 +oid sha256:61982627878a3fa5f5f433ddc2b2d1d781e18c0008d224fabb54388476f50915 +size 52764 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset index cb3480f..c2a8aca 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d21c0fb7a79d5390327eb841a5f67304a2ee6b13b68f3faa0c75ed276b1bf2f5 -size 64844 +oid sha256:09dda50c557dcf82fb79de0a80551d3d6d838074015a7437f0c50e6a74e24ed6 +size 68084 diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index dab9f6d..b47c565 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -29,6 +29,7 @@ void UEatableItems::Use(ATempCharacter* Character) else if (Character->Health >= 100) { UE_LOG(LogTemp, Display, TEXT("Health is full")); + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Health is full")); } } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 14a79e7..c429ad4 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -192,7 +192,7 @@ void ATempCharacter::LineTraceLogic() } else { - DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f); + //DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f); MyInteractable->OnInteract(); UE_LOG(LogTemp, Display, TEXT("OnInteract activated")); UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName()); @@ -272,9 +272,21 @@ void ATempCharacter::UseItem(class UBaseItem* Item) } } -void ATempCharacter::BuyItem() +void ATempCharacter::BuyItem(AActor* Item) { - UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING")); - TraceDistance = 1000; - LineTraceLogic(); + UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); + auto ItemArray = Item->FindComponentByClass()->GetItem(0); + if (GoldBalance <= 0) + { + UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); + } + else if (GoldBalance >= ItemArray->ItemCostPrice) + { + GoldBalance -= ItemArray->ItemCostPrice; + Inventory->AddItem(ItemArray); + UE_LOG(LogTemp, Display, TEXT("Item Purchased")); + } + // UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING")); + // TraceDistance = 1000; + // LineTraceLogic(); } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 59eb643..64aaad1 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -78,7 +78,7 @@ public: int OriginalCameraFOV; UFUNCTION(BlueprintCallable, Category= "Items") - void BuyItem(); + void BuyItem(AActor* Item); bool bShopKeeperText = false;