Files
Table-UE/Table/Source/Table/Public/HandManager.h
T

86 lines
2.2 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DetectionManager.h"
#include "HandManager.generated.h"
class AHandActor;
class UGestureManagerComponent;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHandAdded, AHandActor*, Hand);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHandRemoved, AHandActor*, Hand);
UCLASS()
class TABLE_API AHandManager : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AHandManager();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
void SpawnNewHand(const FVector& PalmCenter, const FHandPacketHand& NewHand);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand Tracking|Debug")
ADetectionManager* DM;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand")
TArray<AHandActor*> HandList;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand")
TArray<AHandActor*> DeadHands;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand")
int32 HandAllocationDistance = FMath::Square(1000);;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand")
TSubclassOf<class AHandActor> HandActorClass;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand")
TSubclassOf<class AFingerTip> FingerTipClass;
UFUNCTION(BlueprintCallable)
void AddDeadHand(AHandActor* DeadHand);
UPROPERTY(BlueprintAssignable)
FOnHandAdded OnHandAdded;
UPROPERTY(BlueprintAssignable)
FOnHandRemoved OnHandRemoved;
UFUNCTION(BlueprintCallable)
TArray<AHandActor*>& GetHandList();
//Gestures
UPROPERTY(VisibleAnywhere, Category = "Gesture")
UGestureManagerComponent* GestureManager;
const TArray<AHandActor*>& GetHandList() const { return HandList; }
// GestureManager.h — add these
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gesture")
UDataTable* GestureDefinitionTable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gesture")
UDataTable* GestureActionTable;
private:
void RemoveDeadHands();
void UpdateHands();
};