Merge remote-tracking branch 'origin/merchant-system-v4' into dev

This commit is contained in:
Philip W 2023-02-06 13:53:22 +00:00
commit a16de31aa2
6 changed files with 24 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,12 +17,18 @@ void UEatableItems::Use(ATempCharacter* Character)
if(Character)
{
if(isHealingItem == true)
{
if (Character->Health < 100)
{
Character->Health += 10;
UE_LOG(LogTemp, Display, TEXT("Healed"));
//delete itself
Character->Inventory->RemoveItem(this);
}
else if (Character->Health >= 100)
{
UE_LOG(LogTemp, Display, TEXT("Health is full"));
}
}
if(isDamageBuffItem == true)
{

View File

@ -24,6 +24,7 @@ void ATempCharacter::BeginPlay()
{
Super::BeginPlay();
Health = 100;
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
}
//Binds the input we made in the setup player component to the forward vector
@ -85,6 +86,7 @@ void ATempCharacter::LineTraceLogic()
}
if(OutHit.GetActor()->FindComponentByClass<UInventoryComponent>())
{
UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if(GoldBalance >= ItemArray->ItemCostPrice)
{
@ -139,13 +141,13 @@ void ATempCharacter::LineTraceLogic()
void ATempCharacter::InputDisabler()
{
UE_LOG(LogTemp, Display, TEXT("Disabling playermovement"));
disableTab = true;
//GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed);
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true);
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true);
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true;
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = true;
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = true;
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
if (ThisCamera == nullptr)
{
return;
@ -163,6 +165,7 @@ void ATempCharacter::InputDisabler()
void ATempCharacter::InputEnabler()
{
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
disableTab = true;
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false);
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false);
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
@ -170,7 +173,6 @@ void ATempCharacter::InputEnabler()
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
//GetWorld()->GetFirstPlayerController()->InputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
TraceDistance = 300;
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
if (ThisCamera == nullptr)
{
return;

View File

@ -78,4 +78,7 @@ public:
bool bShopKeeperText = false;
UPROPERTY(BlueprintReadWrite)
bool disableTab = false;
};