constructing ability syste component and attribute set
This commit is contained in:
parent
af3da182c4
commit
22ce1ea591
@ -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[] { "GameplayAbilities", "GameplayTags", "GameplayTasks" });
|
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" });
|
||||||
|
@ -10,6 +10,11 @@ AAuraCharacterBase::AAuraCharacterBase()
|
|||||||
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UAbilitySystemComponent* AAuraCharacterBase::GetAbilitySystemComponent() const
|
||||||
|
{
|
||||||
|
return AbilitySystemComponent;
|
||||||
|
}
|
||||||
|
|
||||||
void AAuraCharacterBase::BeginPlay()
|
void AAuraCharacterBase::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
@ -3,11 +3,18 @@
|
|||||||
|
|
||||||
#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()
|
||||||
{
|
{
|
||||||
GetMesh()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
|
GetMesh()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
|
||||||
|
|
||||||
|
AbilitySystemComponent = CreateDefaultSubobject<UAuraAbilitySystemComponent>("AbilitySystemComponent");
|
||||||
|
AbilitySystemComponent->SetIsReplicated(true);
|
||||||
|
|
||||||
|
AttributeSet = CreateDefaultSubobject<UAuraAttributeSet>("AttributeSet");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AAuraEnemy::HighlightActor()
|
void AAuraEnemy::HighlightActor()
|
||||||
|
@ -3,7 +3,20 @@
|
|||||||
|
|
||||||
#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");
|
||||||
|
|
||||||
SetNetUpdateFrequency(100.f);
|
SetNetUpdateFrequency(100.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UAbilitySystemComponent* AAuraPlayerState::GetAbilitySystemComponent() const
|
||||||
|
{
|
||||||
|
return AbilitySystemComponent;
|
||||||
|
}
|
||||||
|
@ -3,20 +3,32 @@
|
|||||||
#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) // Abstract so that it cannot be dragged to a level
|
UCLASS(Abstract) // Abstract so that it cannot be dragged to a level
|
||||||
class AURA_API AAuraCharacterBase : public ACharacter
|
class AURA_API AAuraCharacterBase : public ACharacter, public IAbilitySystemInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AAuraCharacterBase();
|
AAuraCharacterBase();
|
||||||
|
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||||||
|
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
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,27 @@
|
|||||||
#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;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user