Files
Table-UE/Table/Source/Table/Private/GestureAction.cpp
T

64 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "GestureAction.h"
#include "HandActor.h"
#include "TableIconActor.h"
// Sets default values
AGestureAction::AGestureAction()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
}
// Called when the game starts or when spawned
void AGestureAction::BeginPlay()
{
Super::BeginPlay();
}
void AGestureAction::InitAction_Implementation(AHandActor* Hand, const FGestureBinding& NewBinding, float NewUEUnitsPerUnit)
{
HandA = Hand;
bRequiresSecondHand = Binding.LeftGesture != "" && Binding.RightGesture != "";
bExtendable = Binding.ExtendedGestures.IsEmpty();
Binding = NewBinding;
HandManager = Hand->HandManager;
UEUnitsPerUnit = NewUEUnitsPerUnit;
}
void AGestureAction::UpdateAction_Implementation()
{
Destroy();
}
void AGestureAction::AbortAction_Implementation()
{
for (ATableIconActor* Icon : Icons)
Icon->bPersistOnActionEnd = false;
EndGesture();
}
void AGestureAction::AddExtension_Implementation(AGestureAction* OtherAction)
{
LinkedActions = OtherAction;
}
void AGestureAction::AddOtherHand_Implementation(AHandActor* OtherHand)
{
HandB = OtherHand;
}
void AGestureAction::EndGesture_Implementation()
{
DestroyIcons();
Destroy();
}
void AGestureAction::DestroyIcons()
{
for (ATableIconActor* Icon : Icons)
if (IsValid(Icon) ) Icon->OnActionEnded();
Icons.Empty();
}