D1/Source/D1/Components/StateManagerComponent.h

53 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Definitions/CombatGameplayTags.h"
#include "StateManagerComponent.generated.h"
DECLARE_MULTICAST_DELEGATE_OneParam(FStateBegin, FGameplayTag);
DECLARE_MULTICAST_DELEGATE_OneParam(FStateEnd, FGameplayTag);
DECLARE_MULTICAST_DELEGATE_OneParam(FActionBegin, FGameplayTag);
DECLARE_MULTICAST_DELEGATE_OneParam(FActionEnd, FGameplayTag);
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class D1_API UStateManagerComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UStateManagerComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
public:
void SetCurrentState(FGameplayTag NewState);
FGameplayTag GetCurrentState();
void ResetState();
bool IsCurrentStateEqualToAny(FGameplayTagContainer StatesToCheck);
void SetCurrentAction(FGameplayTag NewAction);
FGameplayTag GetCurrentAction();
bool IsCurrentActionEqualToAny(FGameplayTagContainer ActionToCheck);
public: //Delegate
FStateBegin OnStateBegin;
FStateEnd OnStateEnd;
FActionBegin OnActionBegin;
FActionEnd OnActionEnd;
private:
FGameplayTag CurrentState;
FGameplayTag CurrentAction;
};