20. Constructing the ASC and AS
This commit is contained in:
parent
70d51d869c
commit
f43daaed61
Binary file not shown.
BIN
Project/Binaries/Win64/UnrealEditor-Gasa.pdb
Normal file
BIN
Project/Binaries/Win64/UnrealEditor-Gasa.pdb
Normal file
Binary file not shown.
4
Project/Source/Gasa/AbilitySystem/GasaAbilitySystem.h
Normal file
4
Project/Source/Gasa/AbilitySystem/GasaAbilitySystem.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
|
@ -1,12 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "AbilitySystemInterface.h"
|
||||
|
||||
#include "GasaCommon.h"
|
||||
|
||||
#include "GasaAbilitySystemComponent.generated.h"
|
||||
|
||||
|
||||
UCLASS()
|
||||
class GASA_API UGasaAbilitySystemComp : public UAbilitySystemComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
};
|
||||
|
||||
namespace Gasa
|
||||
{
|
||||
inline
|
||||
UGasaAbilitySystemComp* GetAbilitySystem(UObject* Object)
|
||||
{
|
||||
if (Object->Implements<UAbilitySystemInterface>())
|
||||
{
|
||||
return Cast<UGasaAbilitySystemComp>( Cast<IAbilitySystemInterface>(Object)->GetAbilitySystemComponent() );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,7 +1,14 @@
|
||||
#include "GasaPlayerState.h"
|
||||
|
||||
#include "AbilitySystem/GasaAbilitySystemComponent.h"
|
||||
|
||||
AGasaPlayerState::AGasaPlayerState()
|
||||
{
|
||||
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
|
||||
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
|
||||
|
||||
// Replication
|
||||
NetUpdateFrequency = 100.f;
|
||||
}
|
||||
|
@ -1,13 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "AbilitySystemInterface.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
|
||||
#include "GasaCommon.h"
|
||||
|
||||
#include "GasaPlayerState.generated.h"
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API AGasaPlayerState : public APlayerState
|
||||
, 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
|
||||
|
||||
AGasaPlayerState();
|
||||
|
||||
#pragma region IAbilitySystem
|
||||
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
|
||||
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
|
||||
#pragma endregion IAbilitySystem
|
||||
};
|
||||
|
@ -11,6 +11,11 @@
|
||||
#pragma region Engine Forwards
|
||||
struct FInputActionValue;
|
||||
|
||||
class IAbilitySystemInterface;
|
||||
|
||||
class UAbilitySystemComponent;
|
||||
class UAbilitySystemInterface;
|
||||
class UAttributeSet;
|
||||
class UCameraComponent;
|
||||
class UInputAction;
|
||||
class UInputMappingContext;
|
||||
@ -31,9 +36,11 @@ class AGasaGameState;
|
||||
class AGasaLevelScriptActor;
|
||||
class AGasaPlayerController;
|
||||
|
||||
class UGasaAbilitySystemComp;
|
||||
class UGasaDevOptions;
|
||||
#pragma endregion Forwards
|
||||
|
||||
#pragma region Logging
|
||||
// Straight from the Engine
|
||||
UENUM(BlueprintType)
|
||||
enum class EGasaVerbosity : uint8
|
||||
@ -122,3 +129,4 @@ namespace Gasa
|
||||
#define GASA_Log(Message) UE_LOG( Gasa, Log, TEXT("%s -- %hs %hs(%d)"), *Message, __builtin_File(), __func__, __builtin_LINE() );
|
||||
#define GASA_Verbose(Message) UE_LOG( Gasa, Verbose, TEXT("%s -- %hs %hs(%d)"), *Message, __builtin_File(), __func__, __builtin_LINE() );
|
||||
#define GASA_VeryVerbose(Message) UE_LOG( Gasa, VeryVerbose, TEXT("%s -- %hs %hs(%d)"), *Message, __builtin_File(), __func__, __builtin_LINE() );
|
||||
#pragma endregion Logging
|
||||
|
Loading…
Reference in New Issue
Block a user