Merge pull request #34 from Games-Academy-Student-Work-22-23/merchant-polish

Merchant polish
This commit is contained in:
Philip W 2023-05-09 13:10:38 +01:00 committed by GitHub Enterprise
commit 6a94ce98ec
21 changed files with 79 additions and 25 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Images/MerchantUI/BLCK_ArrowLeftFilled.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BLCK_ArrowLeftHollow.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BLCK_ArrowLeftShadowFilled.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BLCK_ArrowRightFilled.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BLCK_ArrowRightFilledShadow.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BLCK_ArrowRightHollowi.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BuyShadow.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/BuyUI.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/CancelShadow.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/CancelUi.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/DialiougeBox.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/ExitButtonBlack.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Images/MerchantUI/ExitShadow.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Levels/Build.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -76,7 +76,7 @@ public:
class UInventoryComponent* StoredItems; class UInventoryComponent* StoredItems;
//The buy class to purchase the item //The buy class to purchase the item
virtual void Buy(class ATempCharacter* PurchaseItem) PURE_VIRTUAL(UBaseItem); // WILL SET THIS UP LATER virtual void Buy(class ATempCharacter* BuyItem) PURE_VIRTUAL(UBaseItem); // WILL SET THIS UP LATER
//The use Item class to use the item in the player Inventory //The use Item class to use the item in the player Inventory
virtual void Use(class ATempCharacter* Character); virtual void Use(class ATempCharacter* Character);

View File

@ -25,8 +25,8 @@ void AInteraction::BeginPlay()
Super::BeginPlay(); Super::BeginPlay();
//Character & Camera refs //Character & Camera refs
if (TempCharacterRef != nullptr) TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter()); TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter());
if (MainCamera != nullptr) MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>()); MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>());
//Item refs //Item refs
TargetHealingLocation = HealingItem->GetActorLocation(); TargetHealingLocation = HealingItem->GetActorLocation();
@ -130,7 +130,14 @@ void AInteraction::CameraLeftMover()
UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed")); UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed"));
if (TempCharacterRef == nullptr || BuyHealingProperty == nullptr) if (TempCharacterRef == nullptr || BuyHealingProperty == nullptr)
{ {
UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); if (TempCharacterRef == nullptr)
{
UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp"));
}
else if (BuyHealingProperty == nullptr)
{
UE_LOG(LogTemp, Display, TEXT("HealingItem Not Found"));
}
return; return;
} }
else else

View File

@ -271,19 +271,27 @@ void ATempCharacter::UseItem(class UBaseItem* Item)
void ATempCharacter::BuyItem(AActor* Item) void ATempCharacter::BuyItem(AActor* Item)
{ {
UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); if (Item == nullptr)
auto ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if (GoldBalance <= 0)
{ {
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; UBaseItem* ItemArray = Item->FindComponentByClass<UInventoryComponent>()->GetItem(0);
Inventory->AddItem(ItemArray); if (GoldBalance <= 0)
UE_LOG(LogTemp, Display, TEXT("Item Purchased")); {
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();
} }