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;
|
||||
//Setting ShopWidgetText back to 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"));
|
||||
|
||||
if (Property == nullptr)
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
|
||||
UPROPERTY()
|
||||
bool bDisableShopDialMove = false;
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
|
||||
virtual void CameraLeftMover();
|
||||
|
@ -101,18 +101,35 @@ void ATempCharacter::LineTraceLogic()
|
||||
|
||||
if (AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
|
||||
{
|
||||
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->ShopDialogWidget->IsVisible())
|
||||
{
|
||||
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();
|
||||
break;
|
||||
return;
|
||||
}
|
||||
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()
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Disabling playermovement"));
|
||||
//GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed);
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true);
|
||||
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true);
|
||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true;
|
||||
@ -150,6 +168,7 @@ void ATempCharacter::InputEnabler()
|
||||
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
|
||||
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
|
||||
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)
|
||||
|
@ -75,5 +75,7 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category= "Items")
|
||||
void BuyItem();
|
||||
|
||||
bool bShopKeeperText = false;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user