91 lines
2.8 KiB
C++
91 lines
2.8 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Pawn.h"
|
|
#include "ProjectEleri/Public/Interface/ZoneInteractableInterface.h"
|
|
#include "ProjectEleri/Public/Interface/NpcSpeakerDataInterface.h"
|
|
#include "ProjectEleri/Data/FaceExpressionDataAsset.h"
|
|
#include "StateTreeModule/Public/StateTree.h"
|
|
#include "BaseCharacter.generated.h"
|
|
|
|
class UPaperFlipbookComponent;
|
|
class UExtendedPawnMovement;
|
|
class UDialogueComponent;
|
|
class UStateTreeAIComponent;
|
|
class UCapsuleComponent;
|
|
class USkeletalMeshComponent;
|
|
|
|
UCLASS(BlueprintType)
|
|
class PROJECTELERI_API ABaseCharacter : public APawn, public IZoneInteractableInterface, public INpcSpeakerDataInterface
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
protected:
|
|
ABaseCharacter();
|
|
|
|
public:
|
|
|
|
// Called every frame
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void ChangeFaceAnimation(EDialogueEmotion Emotion);
|
|
|
|
UPROPERTY(Category = Character, EditDefaultsOnly, BlueprintReadOnly)
|
|
TSoftObjectPtr<UStateTree> CharacterStateTree;
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure)
|
|
UCapsuleComponent* GetCapsuleComponent() { return Capsule; }
|
|
|
|
virtual FText GetInteractionText_Implementation() override { return FText::FromString("Talk"); }
|
|
virtual void Interact_Implementation() override;
|
|
|
|
protected:
|
|
UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
|
|
FText CharacterName;
|
|
|
|
UPROPERTY(Category = Character, EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
|
|
TSoftObjectPtr<UFaceExpressionDataAsset> FaceExpressionData;
|
|
UPROPERTY(Category = Character, EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
|
|
bool bHasFaceAnimation = false;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
|
TObjectPtr<UStateTreeAIComponent> StateTreeComponent;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")
|
|
UCapsuleComponent* Capsule;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")
|
|
USkeletalMeshComponent* Mesh;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Movement")
|
|
UExtendedPawnMovement* MovementComponent;
|
|
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
virtual void BeginDestroy() override;
|
|
|
|
UFUNCTION()
|
|
void OnMinutesAdded(FTimeOfDayData TimeOfDay);
|
|
|
|
UFUNCTION()
|
|
void OnFaceDataLoaded(const FSoftObjectPath& Path, UObject* Object);
|
|
void SetupFaceAnimationPlayer();
|
|
|
|
UPROPERTY()
|
|
USkeletalMeshComponent* CharFaceMesh = nullptr;
|
|
UPROPERTY()
|
|
UMaterialInstanceDynamic* DynamicFaceMaterial;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
FFaceFrameData CurrentFaceFrameData;
|
|
|
|
float SecondsTillNextFaceFrame = 0.f;
|
|
int32 CurrentFaceFrameIndex = 0;
|
|
|
|
public:
|
|
virtual FText GetNpcName_Implementation() override { return CharacterName;}
|
|
};
|