Move HealthComponent to base Character class
This commit is contained in:
parent
8bf01234a0
commit
e06b1738c2
|
@ -27,9 +27,6 @@ APlayerCharacter::APlayerCharacter()
|
|||
CameraComponent->SetProjectionMode(ECameraProjectionMode::Type::Orthographic);
|
||||
CameraComponent->SetOrthoWidth(4000.0f);
|
||||
|
||||
// Create Health Component
|
||||
HealthComponent = CreateDefaultSubobject<UHealthComponent>(TEXT("Health Component"));
|
||||
|
||||
// Create EXP Component
|
||||
EXPComponent = CreateDefaultSubobject<UEXPComponent>(TEXT("EXP Component"));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "CoreMinimal.h"
|
||||
#include "EXPComponent.h"
|
||||
#include "HealthComponent.h"
|
||||
#include "VampireCharacter.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
|
@ -35,8 +34,6 @@ public:
|
|||
UInputAction* MovementAction;
|
||||
|
||||
protected:
|
||||
UPROPERTY()
|
||||
UHealthComponent* HealthComponent;
|
||||
|
||||
UPROPERTY()
|
||||
UEXPComponent* EXPComponent;
|
||||
|
|
|
@ -9,6 +9,8 @@ AVampireCharacter::AVampireCharacter()
|
|||
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
// Create Health Component
|
||||
HealthComponent = CreateDefaultSubobject<UHealthComponent>(TEXT("Health Component"));
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "HealthComponent.h"
|
||||
#include "VampireCharacter.generated.h"
|
||||
|
||||
UCLASS()
|
||||
|
@ -11,6 +12,11 @@ class VAMPIRES_API AVampireCharacter : public ACharacter
|
|||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
|
||||
UPROPERTY()
|
||||
UHealthComponent* HealthComponent;
|
||||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
AVampireCharacter();
|
||||
|
|
Loading…
Reference in New Issue