diff --git a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp index a5a1a9f..40d8473 100644 --- a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp +++ b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp @@ -60,7 +60,7 @@ bool UInventoryComponent::Remove(class UBaseItem* BaseItem) return false; } -UBaseItem* UInventoryComponent::GetItem(int32 Index) +UBaseItem* UInventoryComponent::GetItem(int Index) { return Items[Index]; } diff --git a/Source/the_twilight_abyss/BaseItems/InventoryComponent.h b/Source/the_twilight_abyss/BaseItems/InventoryComponent.h index bcfead2..af87438 100644 --- a/Source/the_twilight_abyss/BaseItems/InventoryComponent.h +++ b/Source/the_twilight_abyss/BaseItems/InventoryComponent.h @@ -40,5 +40,5 @@ public: TArray Items; // The items currently in the inventory UFUNCTION(BlueprintCallable, Category= "Inventory") - class UBaseItem* GetItem(int32 Index); + class UBaseItem* GetItem(int Index); }; diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index dc32492..9a0637b 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -41,6 +41,8 @@ void ATempCharacter::RightMoveInput(float Axis) void ATempCharacter::Tick(float DeltaTime) { Super::Tick(DeltaTime); + + UE_LOG(LogTemp, Warning, TEXT("Gold: %d"),GoldBalance); } // Gives the character the functionality @@ -81,14 +83,11 @@ void ATempCharacter::LineTraceLogic() } if(OutHit.GetActor()->FindComponentByClass()) { - if(GoldBalance >= 100) + if(GoldBalance >= OutHit.GetActor()->FindComponentByClass()->GetItem(0)->ItemCostPrice) { - GoldBalance -= 100; + GoldBalance -= OutHit.GetActor()->FindComponentByClass()->GetItem(0)->ItemCostPrice; Inventory->AddItem(OutHit.GetActor()->FindComponentByClass()->GetItem(0)); - //Inventory->AddItem(Cast(OutHit.GetActor())); - //Inventory->AddItem(OutHit.GetActor()->Get("HealingJelly")); UE_LOG(LogTemp, Display, TEXT("Item Purchased")); - } if(GoldBalance <= 0) {