Construct Ability System Component and Attribute Set
This commit is contained in:
@ -9,7 +9,8 @@
|
|||||||
"Type": "Runtime",
|
"Type": "Runtime",
|
||||||
"LoadingPhase": "Default",
|
"LoadingPhase": "Default",
|
||||||
"AdditionalDependencies": [
|
"AdditionalDependencies": [
|
||||||
"Engine"
|
"Engine",
|
||||||
|
"GameplayAbilities"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -29,6 +30,10 @@
|
|||||||
{
|
{
|
||||||
"Name": "RenderDocPlugin",
|
"Name": "RenderDocPlugin",
|
||||||
"Enabled": false
|
"Enabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "GameplayAbilities",
|
||||||
|
"Enabled": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"TargetPlatforms": [
|
"TargetPlatforms": [
|
||||||
|
@ -8,9 +8,9 @@ public class Aura : ModuleRules
|
|||||||
{
|
{
|
||||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||||
|
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" });
|
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "GameplayAbilities" });
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { "GameplayTags", "GameplayTasks" });
|
||||||
|
|
||||||
// Uncomment if you are using Slate UI
|
// Uncomment if you are using Slate UI
|
||||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
|
||||||
|
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
4
Source/Aura/Private/AbilitySystem/AuraAttributeSet.cpp
Normal file
4
Source/Aura/Private/AbilitySystem/AuraAttributeSet.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
|
||||||
|
#include "AbilitySystem/AuraAttributeSet.h"
|
@ -14,6 +14,11 @@ AAuraCharacterBase::AAuraCharacterBase()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UAbilitySystemComponent* AAuraCharacterBase::GetAbilitySystemComponent() const
|
||||||
|
{
|
||||||
|
return AbilitySystemComponent;
|
||||||
|
}
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
void AAuraCharacterBase::BeginPlay()
|
void AAuraCharacterBase::BeginPlay()
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Character/AuraEnemy.h"
|
#include "Character/AuraEnemy.h"
|
||||||
|
|
||||||
|
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
||||||
|
#include "AbilitySystem/AuraAttributeSet.h"
|
||||||
#include "Aura/Aura.h"
|
#include "Aura/Aura.h"
|
||||||
|
|
||||||
AAuraEnemy::AAuraEnemy()
|
AAuraEnemy::AAuraEnemy()
|
||||||
@ -13,6 +16,11 @@ AAuraEnemy::AAuraEnemy()
|
|||||||
|
|
||||||
Weapon->SetRenderCustomDepth(false);
|
Weapon->SetRenderCustomDepth(false);
|
||||||
Weapon->SetCustomDepthStencilValue(CUSTOM_DEPTH_RED);
|
Weapon->SetCustomDepthStencilValue(CUSTOM_DEPTH_RED);
|
||||||
|
|
||||||
|
AbilitySystemComponent = CreateDefaultSubobject<UAuraAbilitySystemComponent>("AbilitySystemComponent");
|
||||||
|
AbilitySystemComponent->SetIsReplicated(true);
|
||||||
|
|
||||||
|
AttributeSet = CreateDefaultSubobject<UAuraAttributeSet>("AttributeSet");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AAuraEnemy::HighlightActor()
|
void AAuraEnemy::HighlightActor()
|
||||||
|
@ -3,7 +3,21 @@
|
|||||||
|
|
||||||
#include "Player/AuraPlayerState.h"
|
#include "Player/AuraPlayerState.h"
|
||||||
|
|
||||||
|
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
||||||
|
#include "AbilitySystem/AuraAttributeSet.h"
|
||||||
|
|
||||||
AAuraPlayerState::AAuraPlayerState()
|
AAuraPlayerState::AAuraPlayerState()
|
||||||
{
|
{
|
||||||
|
AbilitySystemComponent = CreateDefaultSubobject<UAuraAbilitySystemComponent>("AbilitySystemComponent");
|
||||||
|
AbilitySystemComponent->SetIsReplicated(true);
|
||||||
|
|
||||||
|
AttributeSet = CreateDefaultSubobject<UAuraAttributeSet>("AttributeSet");
|
||||||
|
|
||||||
NetUpdateFrequency = 100.f;
|
NetUpdateFrequency = 100.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UAbilitySystemComponent* AAuraPlayerState::GetAbilitySystemComponent() const
|
||||||
|
{
|
||||||
|
return AbilitySystemComponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "AbilitySystemComponent.h"
|
||||||
|
#include "AuraAbilitySystemComponent.generated.h"
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class AURA_API UAuraAbilitySystemComponent : public UAbilitySystemComponent
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
};
|
16
Source/Aura/Public/AbilitySystem/AuraAttributeSet.h
Normal file
16
Source/Aura/Public/AbilitySystem/AuraAttributeSet.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Assets provided by DruidMechanics. Copyright Jonathan Rampersad 2024
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "AttributeSet.h"
|
||||||
|
#include "AuraAttributeSet.generated.h"
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class AURA_API UAuraAttributeSet : public UAttributeSet
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
};
|
@ -3,11 +3,15 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "AbilitySystemInterface.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "AuraCharacterBase.generated.h"
|
#include "AuraCharacterBase.generated.h"
|
||||||
|
|
||||||
|
class UAbilitySystemComponent;
|
||||||
|
class UAttributeSet;
|
||||||
|
|
||||||
UCLASS(Abstract)
|
UCLASS(Abstract)
|
||||||
class AURA_API AAuraCharacterBase : public ACharacter
|
class AURA_API AAuraCharacterBase : public ACharacter, public IAbilitySystemInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@ -15,6 +19,8 @@ public:
|
|||||||
// Sets default values for this character's properties
|
// Sets default values for this character's properties
|
||||||
AAuraCharacterBase();
|
AAuraCharacterBase();
|
||||||
|
|
||||||
|
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||||||
|
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
@ -22,4 +28,9 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, Category="Combat")
|
UPROPERTY(EditAnywhere, Category="Combat")
|
||||||
TObjectPtr<USkeletalMeshComponent> Weapon;
|
TObjectPtr<USkeletalMeshComponent> Weapon;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAttributeSet> AttributeSet;
|
||||||
};
|
};
|
||||||
|
@ -3,17 +3,29 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
#include "AbilitySystemInterface.h"
|
||||||
#include "GameFramework/PlayerState.h"
|
#include "GameFramework/PlayerState.h"
|
||||||
#include "AuraPlayerState.generated.h"
|
#include "AuraPlayerState.generated.h"
|
||||||
|
|
||||||
|
class UAbilitySystemComponent;
|
||||||
|
class UAttributeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class AURA_API AAuraPlayerState : public APlayerState
|
class AURA_API AAuraPlayerState : public APlayerState, public IAbilitySystemInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AAuraPlayerState();
|
AAuraPlayerState();
|
||||||
|
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||||||
|
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
|
||||||
|
protected:
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<UAttributeSet> AttributeSet;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user