20. Constructing the ASC and AS
This commit is contained in:
@ -1,12 +1,15 @@
|
||||
#include "GasaCharacter.h"
|
||||
|
||||
#include "Game/GasaLevelScriptActor.h"
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
|
||||
#include "AbilitySystem/GasaAbilitySystemComponent.h"
|
||||
#include "Game/GasaLevelScriptActor.h"
|
||||
|
||||
void AGasaCharacter::SetHighlight(EHighlight Desired)
|
||||
{
|
||||
HighlightState = Desired;
|
||||
@ -35,6 +38,14 @@ AGasaCharacter::AGasaCharacter()
|
||||
Weapon = CreateDefaultSubobject<USkeletalMeshComponent>("Weapon");
|
||||
Weapon->SetupAttachment(mesh, FName("WeaponAttach"));
|
||||
Weapon->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
|
||||
if (bAutoAbilitySystem)
|
||||
{
|
||||
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
|
||||
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaCharacter::BeginPlay()
|
||||
|
@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "AbilitySystemInterface.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
#include "GasaCommon.h"
|
||||
|
||||
#include "GasaCharacter.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
@ -14,9 +16,21 @@ enum class EHighlight : uint8
|
||||
|
||||
UCLASS(Abstract)
|
||||
class GASA_API AGasaCharacter : public ACharacter
|
||||
, public IAbilitySystemInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
#pragma region Ability System
|
||||
UPROPERTY(EditAnywhere, Category="Ability System")
|
||||
bool bAutoAbilitySystem = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Ability System")
|
||||
TObjectPtr<UAbilitySystemComponent> AbilitySystem;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Ability System")
|
||||
TObjectPtr<UAttributeSet> Attributes;
|
||||
#pragma endregion Ability System
|
||||
|
||||
#pragma region Combat
|
||||
UPROPERTY(EditAnywhere, Category="Combat")
|
||||
TObjectPtr<USkeletalMeshComponent> Weapon;
|
||||
@ -42,6 +56,11 @@ public:
|
||||
#pragma endregion Highlighting
|
||||
|
||||
AGasaCharacter();
|
||||
|
||||
#pragma region IAbilitySystem
|
||||
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
|
||||
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
|
||||
#pragma endregion IAbilitySystem
|
||||
|
||||
#pragma region Actor
|
||||
void BeginPlay() override;
|
||||
@ -49,3 +68,11 @@ public:
|
||||
void Tick(float DeltaSeconds) override;
|
||||
#pragma endregion Actor
|
||||
};
|
||||
|
||||
namespace Gasa
|
||||
{
|
||||
// UGasaAbilitySystemComp* GetAbilitySystem(AGasaCharacter* Object)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
@ -3,4 +3,6 @@
|
||||
APlayerCharacter::APlayerCharacter()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
bAutoAbilitySystem = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user