feat: Implement core gameplay systems and data assets for health, stamina, stress, movement, hit reactions, and shield defense
This commit is contained in:
3
Source/Framework/Framework.cpp
Normal file
3
Source/Framework/Framework.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_MODULE(FDefaultModuleImpl, Framework);
|
||||
13
Source/Framework/Private/Inventory/DA_EquipmentConfig.cpp
Normal file
13
Source/Framework/Private/Inventory/DA_EquipmentConfig.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "Inventory/DA_EquipmentConfig.h"
|
||||
|
||||
float UDA_EquipmentConfig::GetResistance(FGameplayTag DamageType) const
|
||||
{
|
||||
for (const FDamageTypeResistance& Entry : DamageTypeResistances)
|
||||
{
|
||||
if (Entry.DamageType == DamageType)
|
||||
{
|
||||
return Entry.Resistance;
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
6
Source/Framework/Private/Player/BPC_HealthSystem.cpp
Normal file
6
Source/Framework/Private/Player/BPC_HealthSystem.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "Player/BPC_HealthSystem.h"
|
||||
|
||||
UBPC_HealthSystem::UBPC_HealthSystem()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = false;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "Player/BPC_MovementStateSystem.h"
|
||||
|
||||
UBPC_MovementStateSystem::UBPC_MovementStateSystem()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
}
|
||||
6
Source/Framework/Private/Player/BPC_StaminaSystem.cpp
Normal file
6
Source/Framework/Private/Player/BPC_StaminaSystem.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "Player/BPC_StaminaSystem.h"
|
||||
|
||||
UBPC_StaminaSystem::UBPC_StaminaSystem()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
}
|
||||
6
Source/Framework/Private/Player/BPC_StressSystem.cpp
Normal file
6
Source/Framework/Private/Player/BPC_StressSystem.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "Player/BPC_StressSystem.h"
|
||||
|
||||
UBPC_StressSystem::UBPC_StressSystem()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = true;
|
||||
}
|
||||
5
Source/Framework/Private/Player/PC_CoreController.cpp
Normal file
5
Source/Framework/Private/Player/PC_CoreController.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "Player/PC_CoreController.h"
|
||||
|
||||
APC_CoreController::APC_CoreController()
|
||||
{
|
||||
}
|
||||
5
Source/Framework/Private/Player/PS_CorePlayerState.cpp
Normal file
5
Source/Framework/Private/Player/PS_CorePlayerState.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "Player/PS_CorePlayerState.h"
|
||||
|
||||
APS_CorePlayerState::APS_CorePlayerState()
|
||||
{
|
||||
}
|
||||
13
Source/Framework/Private/State/DA_StateGatingTable.cpp
Normal file
13
Source/Framework/Private/State/DA_StateGatingTable.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "State/DA_StateGatingTable.h"
|
||||
|
||||
bool UDA_StateGatingTable::IsActionGated(FGameplayTag ActionTag, FGameplayTag CurrentState) const
|
||||
{
|
||||
for (const FStateGatingRule& Rule : GatingRules)
|
||||
{
|
||||
if (Rule.ActionTag == ActionTag && Rule.BlockedByState == CurrentState)
|
||||
{
|
||||
return Rule.bIsBlocked;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
11
Source/Framework/Private/Weapons/BPC_HitReactionSystem.cpp
Normal file
11
Source/Framework/Private/Weapons/BPC_HitReactionSystem.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "Weapons/BPC_HitReactionSystem.h"
|
||||
|
||||
UBPC_HitReactionSystem::UBPC_HitReactionSystem()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = false;
|
||||
}
|
||||
|
||||
void UBPC_HitReactionSystem::PlayHitReaction(float DamageAmount, FVector HitDirection, AActor* DamageCauser)
|
||||
{
|
||||
// Stub — Blueprint child provides animation selection logic.
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "Weapons/BPC_ShieldDefenseSystem.h"
|
||||
|
||||
UBPC_ShieldDefenseSystem::UBPC_ShieldDefenseSystem()
|
||||
{
|
||||
PrimaryComponentTick.bCanEverTick = false;
|
||||
}
|
||||
37
Source/Framework/Public/Inventory/DA_EquipmentConfig.h
Normal file
37
Source/Framework/Public/Inventory/DA_EquipmentConfig.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "DA_EquipmentConfig.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FRAMEWORK_API FDamageTypeResistance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FGameplayTag DamageType;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float Resistance = 0.0f;
|
||||
};
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class FRAMEWORK_API UDA_EquipmentConfig : public UPrimaryDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||
TArray<FDamageTypeResistance> DamageTypeResistances;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||
float Durability = 100.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||
float Weight = 1.0f;
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Config")
|
||||
float GetResistance(FGameplayTag DamageType) const;
|
||||
};
|
||||
29
Source/Framework/Public/Player/BPC_HealthSystem.h
Normal file
29
Source/Framework/Public/Player/BPC_HealthSystem.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "BPC_HealthSystem.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnHealthChanged, float, CurrentHealth, float, MaxHealth);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeath);
|
||||
|
||||
UCLASS(Blueprintable, ClassGroup=(Framework), meta=(BlueprintSpawnableComponent))
|
||||
class FRAMEWORK_API UBPC_HealthSystem : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UBPC_HealthSystem();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|Health")
|
||||
float MaxHealth = 100.0f;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Framework|Health")
|
||||
float CurrentHealth = 100.0f;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Framework|Events")
|
||||
FOnHealthChanged OnHealthChanged;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Framework|Events")
|
||||
FOnDeath OnDeath;
|
||||
};
|
||||
23
Source/Framework/Public/Player/BPC_MovementStateSystem.h
Normal file
23
Source/Framework/Public/Player/BPC_MovementStateSystem.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "BPC_MovementStateSystem.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMovementModeChanged, FGameplayTag, NewMode, FGameplayTag, OldMode);
|
||||
|
||||
UCLASS(Blueprintable, ClassGroup=(Framework), meta=(BlueprintSpawnableComponent))
|
||||
class FRAMEWORK_API UBPC_MovementStateSystem : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UBPC_MovementStateSystem();
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Framework|Movement")
|
||||
FGameplayTag CurrentMovementMode;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Framework|Events")
|
||||
FOnMovementModeChanged OnMovementModeChanged;
|
||||
};
|
||||
25
Source/Framework/Public/Player/BPC_StaminaSystem.h
Normal file
25
Source/Framework/Public/Player/BPC_StaminaSystem.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "BPC_StaminaSystem.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnExhaustionStateChanged, bool, bExhausted);
|
||||
|
||||
UCLASS(Blueprintable, ClassGroup=(Framework), meta=(BlueprintSpawnableComponent))
|
||||
class FRAMEWORK_API UBPC_StaminaSystem : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UBPC_StaminaSystem();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|Stamina")
|
||||
float MaxStamina = 100.0f;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Framework|Stamina")
|
||||
float CurrentStamina = 100.0f;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Framework|Events")
|
||||
FOnExhaustionStateChanged OnExhaustionStateChanged;
|
||||
};
|
||||
32
Source/Framework/Public/Player/BPC_StressSystem.h
Normal file
32
Source/Framework/Public/Player/BPC_StressSystem.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "BPC_StressSystem.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EStressTier : uint8
|
||||
{
|
||||
Calm UMETA(DisplayName = "Calm"),
|
||||
Tense UMETA(DisplayName = "Tense"),
|
||||
Distressed UMETA(DisplayName = "Distressed"),
|
||||
Panic UMETA(DisplayName = "Panic"),
|
||||
Catatonic UMETA(DisplayName = "Catatonic"),
|
||||
};
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnStressTierChanged, EStressTier, NewTier);
|
||||
|
||||
UCLASS(Blueprintable, ClassGroup=(Framework), meta=(BlueprintSpawnableComponent))
|
||||
class FRAMEWORK_API UBPC_StressSystem : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UBPC_StressSystem();
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Framework|Stress")
|
||||
EStressTier StressTier = EStressTier::Calm;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Framework|Events")
|
||||
FOnStressTierChanged OnStressTierChanged;
|
||||
};
|
||||
14
Source/Framework/Public/Player/PC_CoreController.h
Normal file
14
Source/Framework/Public/Player/PC_CoreController.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "PC_CoreController.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FRAMEWORK_API APC_CoreController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
APC_CoreController();
|
||||
};
|
||||
14
Source/Framework/Public/Player/PS_CorePlayerState.h
Normal file
14
Source/Framework/Public/Player/PS_CorePlayerState.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include "PS_CorePlayerState.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FRAMEWORK_API APS_CorePlayerState : public APlayerState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
APS_CorePlayerState();
|
||||
};
|
||||
34
Source/Framework/Public/State/DA_StateGatingTable.h
Normal file
34
Source/Framework/Public/State/DA_StateGatingTable.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "DA_StateGatingTable.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FRAMEWORK_API FStateGatingRule
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FGameplayTag ActionTag;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FGameplayTag BlockedByState;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bIsBlocked = true;
|
||||
};
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class FRAMEWORK_API UDA_StateGatingTable : public UPrimaryDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gating")
|
||||
TArray<FStateGatingRule> GatingRules;
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Gating")
|
||||
bool IsActionGated(FGameplayTag ActionTag, FGameplayTag CurrentState) const;
|
||||
};
|
||||
24
Source/Framework/Public/Weapons/BPC_HitReactionSystem.h
Normal file
24
Source/Framework/Public/Weapons/BPC_HitReactionSystem.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "BPC_HitReactionSystem.generated.h"
|
||||
|
||||
UCLASS(Blueprintable, ClassGroup=(Framework), meta=(BlueprintSpawnableComponent))
|
||||
class FRAMEWORK_API UBPC_HitReactionSystem : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UBPC_HitReactionSystem();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Framework|Combat")
|
||||
void PlayHitReaction(float DamageAmount, FVector HitDirection, AActor* DamageCauser);
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|HitReaction")
|
||||
float FlinchThreshold = 5.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|HitReaction")
|
||||
float RagdollThreshold = 50.0f;
|
||||
};
|
||||
26
Source/Framework/Public/Weapons/BPC_ShieldDefenseSystem.h
Normal file
26
Source/Framework/Public/Weapons/BPC_ShieldDefenseSystem.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "BPC_ShieldDefenseSystem.generated.h"
|
||||
|
||||
UCLASS(Blueprintable, ClassGroup=(Framework), meta=(BlueprintSpawnableComponent))
|
||||
class FRAMEWORK_API UBPC_ShieldDefenseSystem : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UBPC_ShieldDefenseSystem();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|Shield")
|
||||
float ShieldHealth = 100.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|Shield")
|
||||
float MaxShieldHealth = 100.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Framework|Shield")
|
||||
float BlockAngle = 90.0f;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Framework|Shield")
|
||||
bool bShieldBroken = false;
|
||||
};
|
||||
Reference in New Issue
Block a user