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)
|
else if (Character->Health >= 100)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Display, TEXT("Health is full"));
|
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
|
else
|
||||||
{
|
{
|
||||||
DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f);
|
//DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f);
|
||||||
MyInteractable->OnInteract();
|
MyInteractable->OnInteract();
|
||||||
UE_LOG(LogTemp, Display, TEXT("OnInteract activated"));
|
UE_LOG(LogTemp, Display, TEXT("OnInteract activated"));
|
||||||
UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName());
|
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"));
|
UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
|
||||||
TraceDistance = 1000;
|
auto ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0);
|
||||||
LineTraceLogic();
|
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;
|
int OriginalCameraFOV;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category= "Items")
|
UFUNCTION(BlueprintCallable, Category= "Items")
|
||||||
void BuyItem();
|
void BuyItem(AActor* Item);
|
||||||
|
|
||||||
bool bShopKeeperText = false;
|
bool bShopKeeperText = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user