Construct Ability System Component and Attribute Set
This commit is contained in:
@ -8,9 +8,9 @@ public class Aura : ModuleRules
|
||||
{
|
||||
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
|
||||
// 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
|
||||
void AAuraCharacterBase::BeginPlay()
|
||||
{
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
|
||||
#include "Character/AuraEnemy.h"
|
||||
|
||||
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
||||
#include "AbilitySystem/AuraAttributeSet.h"
|
||||
#include "Aura/Aura.h"
|
||||
|
||||
AAuraEnemy::AAuraEnemy()
|
||||
@ -13,6 +16,11 @@ AAuraEnemy::AAuraEnemy()
|
||||
|
||||
Weapon->SetRenderCustomDepth(false);
|
||||
Weapon->SetCustomDepthStencilValue(CUSTOM_DEPTH_RED);
|
||||
|
||||
AbilitySystemComponent = CreateDefaultSubobject<UAuraAbilitySystemComponent>("AbilitySystemComponent");
|
||||
AbilitySystemComponent->SetIsReplicated(true);
|
||||
|
||||
AttributeSet = CreateDefaultSubobject<UAuraAttributeSet>("AttributeSet");
|
||||
}
|
||||
|
||||
void AAuraEnemy::HighlightActor()
|
||||
|
@ -3,7 +3,21 @@
|
||||
|
||||
#include "Player/AuraPlayerState.h"
|
||||
|
||||
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
||||
#include "AbilitySystem/AuraAttributeSet.h"
|
||||
|
||||
AAuraPlayerState::AAuraPlayerState()
|
||||
{
|
||||
AbilitySystemComponent = CreateDefaultSubobject<UAuraAbilitySystemComponent>("AbilitySystemComponent");
|
||||
AbilitySystemComponent->SetIsReplicated(true);
|
||||
|
||||
AttributeSet = CreateDefaultSubobject<UAuraAttributeSet>("AttributeSet");
|
||||
|
||||
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
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AbilitySystemInterface.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "AuraCharacterBase.generated.h"
|
||||
|
||||
class UAbilitySystemComponent;
|
||||
class UAttributeSet;
|
||||
|
||||
UCLASS(Abstract)
|
||||
class AURA_API AAuraCharacterBase : public ACharacter
|
||||
class AURA_API AAuraCharacterBase : public ACharacter, public IAbilitySystemInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
@ -15,6 +19,8 @@ public:
|
||||
// Sets default values for this character's properties
|
||||
AAuraCharacterBase();
|
||||
|
||||
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||||
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
@ -22,4 +28,9 @@ protected:
|
||||
UPROPERTY(EditAnywhere, Category="Combat")
|
||||
TObjectPtr<USkeletalMeshComponent> Weapon;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UAttributeSet> AttributeSet;
|
||||
};
|
||||
|
@ -3,17 +3,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AbilitySystemInterface.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include "AuraPlayerState.generated.h"
|
||||
|
||||
class UAbilitySystemComponent;
|
||||
class UAttributeSet;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API AAuraPlayerState : public APlayerState
|
||||
class AURA_API AAuraPlayerState : public APlayerState, public IAbilitySystemInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
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