AzureAbyss/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
MH261677 8c69f58a97 Updated BP_OPENDIAL, Interaction.cpp
Changed the text in the widget and gave it a little animation. Made the Wait timer in interaction changeable in the editor.
2022-11-28 23:15:41 +00:00

42 lines
899 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "Interaction.h"
#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);
}
void AInteraction::OnInteract()
{
CurrentWidget = CreateWidget<UUserWidget>(GetWorld(), Widget);
CurrentWidget->AddToViewport(0);
FTimerHandle WidgetTimer;
GetWorldTimerManager().SetTimer(WidgetTimer, this, &AInteraction::RemoveWidget, WaitTimer, false);
}
void AInteraction::RemoveWidget()
{
CurrentWidget->RemoveFromViewport();
}