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;
|
||||
|
||||
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
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
|
@ -10,6 +10,11 @@ AAuraCharacterBase::AAuraCharacterBase()
|
||||
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
}
|
||||
|
||||
UAbilitySystemComponent* AAuraCharacterBase::GetAbilitySystemComponent() const
|
||||
{
|
||||
return AbilitySystemComponent;
|
||||
}
|
||||
|
||||
void AAuraCharacterBase::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
@ -3,11 +3,18 @@
|
||||
|
||||
#include "Character/AuraEnemy.h"
|
||||
|
||||
#include "AbilitySystem/AuraAbilitySystemComponent.h"
|
||||
#include "AbilitySystem/AuraAttributeSet.h"
|
||||
#include "Aura/Aura.h"
|
||||
|
||||
AAuraEnemy::AAuraEnemy()
|
||||
{
|
||||
GetMesh()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
|
||||
|
||||
AbilitySystemComponent = CreateDefaultSubobject<UAuraAbilitySystemComponent>("AbilitySystemComponent");
|
||||
AbilitySystemComponent->SetIsReplicated(true);
|
||||
|
||||
AttributeSet = CreateDefaultSubobject<UAuraAttributeSet>("AttributeSet");
|
||||
}
|
||||
|
||||
void AAuraEnemy::HighlightActor()
|
||||
|
@ -3,7 +3,20 @@
|
||||
|
||||
#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");
|
||||
|
||||
SetNetUpdateFrequency(100.f);
|
||||
}
|
||||
|
||||
UAbilitySystemComponent* AAuraPlayerState::GetAbilitySystemComponent() const
|
||||
{
|
||||
return AbilitySystemComponent;
|
||||
}
|
||||
|
@ -3,20 +3,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AbilitySystemInterface.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "AuraCharacterBase.generated.h"
|
||||
|
||||
class UAbilitySystemComponent;
|
||||
class UAttributeSet;
|
||||
|
||||
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()
|
||||
|
||||
public:
|
||||
AAuraCharacterBase();
|
||||
virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override;
|
||||
UAttributeSet* GetAttributeSet() const { return AttributeSet; }
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Combat")
|
||||
TObjectPtr<USkeletalMeshComponent> Weapon;
|
||||
|
||||
UPROPERTY ()
|
||||
TObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
|
||||
|
||||
UPROPERTY ()
|
||||
TObjectPtr<UAttributeSet> AttributeSet;
|
||||
};
|
||||
|
@ -3,17 +3,27 @@
|
||||
#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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user