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