2022-11-13 16:43:01 +00:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
#include "Interaction.h"
|
|
|
|
|
2023-01-14 20:35:49 +00:00
|
|
|
#include "Chaos/BoundingVolumeUtilities.h"
|
2022-11-13 16:43:01 +00:00
|
|
|
#include "Components/WidgetComponent.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sets default values
|
|
|
|
AInteraction::AInteraction()
|
|
|
|
{
|
|
|
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
|
|
|
PrimaryActorTick.bCanEverTick = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called when the game starts or when spawned
|
|
|
|
void AInteraction::BeginPlay()
|
|
|
|
{
|
|
|
|
Super::BeginPlay();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called every frame
|
|
|
|
void AInteraction::Tick(float DeltaTime)
|
|
|
|
{
|
|
|
|
Super::Tick(DeltaTime);
|
2023-01-14 20:35:49 +00:00
|
|
|
|
2022-11-13 16:43:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AInteraction::OnInteract()
|
|
|
|
{
|
2022-11-28 22:52:51 +00:00
|
|
|
CurrentWidget = CreateWidget<UUserWidget>(GetWorld(), Widget);
|
|
|
|
CurrentWidget->AddToViewport(0);
|
2023-01-14 20:35:49 +00:00
|
|
|
//handles the widget dissapearing from the viewport
|
2022-11-28 22:52:51 +00:00
|
|
|
FTimerHandle WidgetTimer;
|
2022-11-28 23:15:41 +00:00
|
|
|
GetWorldTimerManager().SetTimer(WidgetTimer, this, &AInteraction::RemoveWidget, WaitTimer, false);
|
2023-01-14 20:35:49 +00:00
|
|
|
|
2022-11-13 16:43:01 +00:00
|
|
|
}
|
|
|
|
|
2022-11-28 22:52:51 +00:00
|
|
|
void AInteraction::RemoveWidget()
|
|
|
|
{
|
2023-01-14 20:35:49 +00:00
|
|
|
bisDisabled = true;
|
2022-11-28 22:52:51 +00:00
|
|
|
CurrentWidget->RemoveFromViewport();
|
2023-01-14 20:35:49 +00:00
|
|
|
UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true"));
|
|
|
|
|
2022-11-28 22:52:51 +00:00
|
|
|
}
|