Merge movement-component #1

Merged
baz merged 20 commits from movement-component into master 2024-01-18 18:30:17 +01:00
6 changed files with 21 additions and 6 deletions
Showing only changes of commit 01aeecf953 - Show all commits

View File

@ -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"));

View File

@ -27,7 +27,7 @@ private:
FTimerHandle CooldownTimerHandle; FTimerHandle CooldownTimerHandle;
public: public:
AEnemyCharacter(); AEnemyCharacter(const FObjectInitializer& ObjectInitializer);
UBehaviorTree* GetBehaviourTree(); UBehaviorTree* GetBehaviourTree();

View File

@ -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");

View File

@ -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

View File

@ -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;

View File

@ -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