Updated Interaction,TempCharacter.cpp
Fixed being able to open the text widget while the selector is open so merchant is fully working now.
This commit is contained in:
parent
63e44f47e8
commit
f33c43689b
@ -93,6 +93,14 @@ void AInteraction::RemoveWidget()
|
|||||||
bisDisabled = true;
|
bisDisabled = true;
|
||||||
//Setting ShopWidgetText back to hidden
|
//Setting ShopWidgetText back to hidden
|
||||||
ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden);
|
ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden);
|
||||||
|
if (ShopDialogWidget->IsVisible())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UE_LOG(LogTemp, Display, TEXT("You cant open this widget when this widget is open"));
|
||||||
|
}
|
||||||
UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true"));
|
UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true"));
|
||||||
|
|
||||||
if (Property == nullptr)
|
if (Property == nullptr)
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
bool bDisableShopDialMove = false;
|
bool bDisableShopDialMove = false;
|
||||||
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
|
UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
|
||||||
virtual void CameraLeftMover();
|
virtual void CameraLeftMover();
|
||||||
|
@ -101,18 +101,35 @@ void ATempCharacter::LineTraceLogic()
|
|||||||
|
|
||||||
if (AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
|
if (AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
|
||||||
{
|
{
|
||||||
DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f);
|
if (MyInteractable->ShopDialogWidget->IsVisible())
|
||||||
MyInteractable->OnInteract();
|
|
||||||
UE_LOG(LogTemp, Display, TEXT("OnInteract activated"));
|
|
||||||
UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName());
|
|
||||||
|
|
||||||
// While loop to check bisDisabled var until it changes to true
|
|
||||||
while (MyInteractable->bisDisabled == false || MyInteractable->bDisableShopDialMove == false)
|
|
||||||
{
|
{
|
||||||
if (MyInteractable->bisDisabled == true || MyInteractable->bDisableShopDialMove == true)
|
UE_LOG(LogTemp, Display, TEXT("ShopKeeper text is visible"));
|
||||||
|
bShopKeeperText = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if there is no text on screen this triggers
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MyInteractable->ItemSelectorWidget->IsVisible())
|
||||||
{
|
{
|
||||||
InputDisabler();
|
return;
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f);
|
||||||
|
MyInteractable->OnInteract();
|
||||||
|
UE_LOG(LogTemp, Display, TEXT("OnInteract activated"));
|
||||||
|
UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName());
|
||||||
|
|
||||||
|
// While loop to check bisDisabled var until it changes to true
|
||||||
|
while (MyInteractable->bisDisabled == false || MyInteractable->bDisableShopDialMove == false)
|
||||||
|
{
|
||||||
|
if (MyInteractable->bisDisabled == true || MyInteractable->bDisableShopDialMove == true)
|
||||||
|
{
|
||||||
|
InputDisabler();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,6 +139,7 @@ void ATempCharacter::LineTraceLogic()
|
|||||||
void ATempCharacter::InputDisabler()
|
void ATempCharacter::InputDisabler()
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Display, TEXT("Disabling playermovement"));
|
UE_LOG(LogTemp, Display, TEXT("Disabling playermovement"));
|
||||||
|
//GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed);
|
||||||
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true);
|
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true);
|
||||||
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true);
|
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true);
|
||||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true;
|
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true;
|
||||||
@ -150,6 +168,7 @@ void ATempCharacter::InputEnabler()
|
|||||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
|
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
|
||||||
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
|
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
|
||||||
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
|
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
|
||||||
|
//GetWorld()->GetFirstPlayerController()->InputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed);
|
||||||
TraceDistance = 300;
|
TraceDistance = 300;
|
||||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||||
if (ThisCamera == nullptr)
|
if (ThisCamera == nullptr)
|
||||||
|
@ -75,5 +75,7 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category= "Items")
|
UFUNCTION(BlueprintCallable, Category= "Items")
|
||||||
void BuyItem();
|
void BuyItem();
|
||||||
|
|
||||||
|
bool bShopKeeperText = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user