Bugfix Merchant Unable to Purchase Items
This commit is contained in:
parent
e28da9ab26
commit
3f5c7bcf1c
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset
(Stored with Git LFS)
Binary file not shown.
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<UInventoryComponent>()->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();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
int OriginalCameraFOV;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category= "Items")
|
||||
void BuyItem();
|
||||
void BuyItem(AActor* Item);
|
||||
|
||||
bool bShopKeeperText = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user