Replace default CharacterMovementComponent with NakatomiCMC
This commit is contained in:
parent
56aa855a7c
commit
01aeecf953
|
@ -5,7 +5,7 @@
|
|||
|
||||
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
||||
|
||||
AEnemyCharacter::AEnemyCharacter()
|
||||
AEnemyCharacter::AEnemyCharacter(const FObjectInitializer& ObjectInitializer) : ANakatomiCharacter(ObjectInitializer)
|
||||
{
|
||||
RandomWeaponParameters = CreateDefaultSubobject<URandomWeaponParameters>(TEXT("Random Weapon Parameters"));
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ private:
|
|||
FTimerHandle CooldownTimerHandle;
|
||||
|
||||
public:
|
||||
AEnemyCharacter();
|
||||
AEnemyCharacter(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
UBehaviorTree* GetBehaviourTree();
|
||||
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
|
||||
#include "NakatomiCharacter.h"
|
||||
|
||||
#include "NakatomiCMC.h"
|
||||
|
||||
// Sets default values
|
||||
ANakatomiCharacter::ANakatomiCharacter()
|
||||
ANakatomiCharacter::ANakatomiCharacter(const FObjectInitializer& ObjectInitializer) : Super(
|
||||
ObjectInitializer.SetDefaultSubobjectClass<UNakatomiCMC>(ACharacter::CharacterMovementComponentName))
|
||||
{
|
||||
// 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;
|
||||
|
||||
NakatomiCMC = Cast<UNakatomiCMC>(GetCharacterMovement());
|
||||
|
||||
HealthComponent = CreateDefaultSubobject<UHealthComponent>(TEXT("Health Component"));
|
||||
HealthComponent->OnDamaged.BindUFunction(this, "OnDamaged");
|
||||
HealthComponent->OnDeath.BindUFunction(this, "OnDeath");
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "HealthComponent.h"
|
||||
#include "NakatomiCMC.h"
|
||||
#include "Throwable.h"
|
||||
#include "Weapon.h"
|
||||
#include "NakatomiCharacter.generated.h"
|
||||
|
@ -38,6 +39,10 @@ public:
|
|||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TArray<TSubclassOf<AThrowable>> ThrowableInventory;
|
||||
|
||||
protected:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
|
||||
UNakatomiCMC* NakatomiCMC;
|
||||
|
||||
private:
|
||||
UPROPERTY(VisibleDefaultsOnly)
|
||||
UHealthComponent* HealthComponent = nullptr;
|
||||
|
@ -47,9 +52,10 @@ private:
|
|||
UPROPERTY(EditDefaultsOnly)
|
||||
int MaximumThrowableInventorySize = 4;
|
||||
|
||||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
ANakatomiCharacter();
|
||||
ANakatomiCharacter(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define COLLISION_WEAPON ECC_GameTraceChannel1
|
||||
|
||||
// Sets default values
|
||||
APlayerCharacter::APlayerCharacter()
|
||||
APlayerCharacter::APlayerCharacter(const FObjectInitializer& ObjectInitializer) : ANakatomiCharacter(ObjectInitializer)
|
||||
{
|
||||
// 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;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "Blueprint/UserWidget.h"
|
||||
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
||||
#include "InteractableComponent.h"
|
||||
#include "NakatomiCMC.h"
|
||||
#include "Throwable.h"
|
||||
#include "PlayerCharacter.generated.h"
|
||||
|
||||
|
@ -95,6 +96,9 @@ protected:
|
|||
float DefaultAimSensitivity = 45.0f;
|
||||
|
||||
private:
|
||||
// UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
|
||||
// UNakatomiCMC* NakatomiCMC;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Meta = (AllowPrivateAccess = "true"))
|
||||
USpringArmComponent* CameraSpringArmComponent = nullptr;
|
||||
|
||||
|
@ -132,7 +136,7 @@ private:
|
|||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
APlayerCharacter();
|
||||
APlayerCharacter(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
|
|
Loading…
Reference in New Issue