Files
BusyRabbit/Source/BusyRabbit/Public/Level/Actor/BusyPawnBase.h
2025-10-28 23:51:17 +08:00

120 lines
3.6 KiB
C++

#pragma once
#include "Level/Actor/Components/BusyPawnMovement.h"
#include "Level/Actor/Components/BusyAbilitySystemComponent.h"
#include "BusyPawnBase.generated.h"
struct FBusyPawnBaseConfig;
class USpineBoneFollowerComponent;
class USpineSkeletonRendererComponent;
class USpineSkeletonAnimationComponent;
class UBusyPawnMovementComponent;
DECLARE_DYNAMIC_DELEGATE_TwoParams(FGameplayTagAddOrRemoveDelegate, const FGameplayTag&, Tag, const int32, Value);
#define BUSY_ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
DECLARE_LOG_CATEGORY_EXTERN(LogBusyPawn, Log, All);
UCLASS(Blueprintable, BlueprintType)
class UBusyPawnAttributeSet : public UAttributeSet
{
GENERATED_BODY()
public:
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes")
FGameplayAttributeData Health;
BUSY_ATTRIBUTE_ACCESSORS(UBusyPawnAttributeSet, Health);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes")
FGameplayAttributeData MaxHealth;
BUSY_ATTRIBUTE_ACCESSORS(UBusyPawnAttributeSet, MaxHealth);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes")
FGameplayAttributeData MoveSpeed;
BUSY_ATTRIBUTE_ACCESSORS(UBusyPawnAttributeSet, MoveSpeed);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes")
FGameplayAttributeData Damage;
BUSY_ATTRIBUTE_ACCESSORS(UBusyPawnAttributeSet, Damage);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attributes")
FGameplayAttributeData Defense;
BUSY_ATTRIBUTE_ACCESSORS(UBusyPawnAttributeSet, Defense);
};
#undef BUSY_ATTRIBUTE_ACCESSORS
UCLASS()
class ABusyPawnBase : public APawn, public IBusyMovable
{
GENERATED_BODY()
public:
ABusyPawnBase();
virtual void BeginPlay()override;
virtual float GetSpeed_Implementation()const override;
public:
virtual void InitPawnAttributes(const FBusyPawnBaseConfig& Config);
virtual void InitPawnAbilities(const FBusyPawnBaseConfig& Config) const;
public:
UFUNCTION(BlueprintCallable)
void BindGameplayTagAddOrRemove(const FGameplayTag& Tag, FGameplayTagAddOrRemoveDelegate Delegate)const;
protected:
UPROPERTY(EditDefaultsOnly)
TObjectPtr<USceneComponent> RootScene; //场景根组件
/*----------------------------spine相关组件----------------------------*/
UPROPERTY(EditDefaultsOnly)
TObjectPtr<USceneComponent> SpineRoot;
UPROPERTY(EditDefaultsOnly)
TObjectPtr<USpineSkeletonRendererComponent> SpineRenderComponent;
/*-------------------------------------------------------------------*/
/*-----------------------------GAS相关--------------------------------*/
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<UBusyAbilitySystemComponent> AbilitySystemComponent;
/*-------------------------------------------------------------------*/
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<USpineSkeletonAnimationComponent> SpineAnimationComponent;
/*-------------------------------移动组件------------------------------*/
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TObjectPtr<UBusyPawnMovement> MovementComponent;
/*-------------------------------------------------------------------*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, DisplayName="角色名称")
FName PawnName;
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TObjectPtr<UBusyPawnAttributeSet> Attributes = nullptr;
protected:
UPROPERTY(EditAnywhere)
FString DefaultSkinName;
UPROPERTY(EditAnywhere)
FString DefaultAnimationName;
};