Added Gameplay Abilities(Health, MaxHealth, Mana, MaxMana)

This commit is contained in:
Caleb Buhungiro
2025-06-17 22:30:27 +08:00
parent 9a6a072b5a
commit 6d8fc727d2
14 changed files with 234 additions and 12 deletions

View File

@@ -3,18 +3,33 @@
#include "Crunch/Public/Character/CCharacter.h"
#include "GAS/CAbilitySystemComponent.h"
#include "GAS/CAttributeSet.h"
// Sets default values
ACCharacter::ACCharacter()
{
PrimaryActorTick.bCanEverTick = true;
GetMesh()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
CAbilitySystemComponent = CreateDefaultSubobject<UCAbilitySystemComponent>(TEXT("Ability System Component"));
CAttributeSet = CreateDefaultSubobject<UCAttributeSet>(TEXT("CAttribute Set"));
}
void ACCharacter::ServerSideInit()
{
CAbilitySystemComponent->InitAbilityActorInfo(this, this);
CAbilitySystemComponent->ApplyInitialEffects();
}
void ACCharacter::ClientSideInit()
{
CAbilitySystemComponent->InitAbilityActorInfo(this, this);
}
void ACCharacter::BeginPlay()
{
Super::BeginPlay();
}
void ACCharacter::Tick(float DeltaTime)
@@ -27,3 +42,8 @@ void ACCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
UAbilitySystemComponent* ACCharacter::GetAbilitySystemComponent() const
{
return CAbilitySystemComponent;
}