Updated TempCharacter to stop crashes
This commit is contained in:
parent
0632a1770b
commit
b3c83f161f
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
Binary file not shown.
@ -271,19 +271,27 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
|
||||
|
||||
void ATempCharacter::BuyItem(AActor* Item)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
|
||||
UBaseItem* ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0);
|
||||
if (GoldBalance <= 0)
|
||||
if (Item == nullptr)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Not Enough Gold"));
|
||||
UE_LOG(LogTemp, Display, TEXT("Item is null"));
|
||||
return;
|
||||
}
|
||||
else if (GoldBalance >= ItemArray->ItemCostPrice)
|
||||
else
|
||||
{
|
||||
GoldBalance -= ItemArray->ItemCostPrice;
|
||||
Inventory->AddItem(ItemArray);
|
||||
UE_LOG(LogTemp, Display, TEXT("Item Purchased"));
|
||||
UBaseItem* 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();
|
||||
}
|
||||
// UE_LOG(LogTemp, Display, TEXT("BUY ITEM FIRING"));
|
||||
// TraceDistance = 1000;
|
||||
// LineTraceLogic();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user