Start to add hit impact on the sample

This commit is contained in:
Arnaud Jamin
2023-10-18 17:22:50 -04:00
parent 87e87edc13
commit bbb89f09ff
33 changed files with 295 additions and 44 deletions
+35 -7
View File
@@ -8,6 +8,7 @@
#include "CogCommonDebugFilteredActorInterface.h"
#include "CogSampleDamageEvent.h"
#include "CogSampleDefines.h"
#include "CogSampleDamageableInterface.h"
#include "CogSampleTargetableInterface.h"
#include "CogSampleTeamInterface.h"
#include "GameFramework/Character.h"
@@ -16,9 +17,9 @@
#include "InputActionValue.h"
#include "CogSampleCharacter.generated.h"
class UAbilitySystemComponent;
class UCogAbilitySystemComponent;
class UCameraComponent;
class UCogAbilitySystemComponent;
class UCogSampleAbilitySystemComponent;
class UGameplayAbility;
class UGameplayEffect;
class UInputAction;
@@ -58,6 +59,19 @@ public:
bool ActivateWhenGiven = false;
};
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT(BlueprintType)
struct FCogSampleMontageTableRow : public FTableRowBase
{
GENERATED_BODY()
public:
FCogSampleMontageTableRow() {}
UPROPERTY(EditAnywhere, BlueprintReadOnly)
UAnimMontage* Montage = nullptr;
};
//--------------------------------------------------------------------------------------------------------------------------
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCogSampleCharacterEventDelegate, ACogSampleCharacter*, Character);
@@ -69,6 +83,7 @@ class ACogSampleCharacter : public ACharacter
, public ICogCommonAllegianceActorInterface
, public ICogSampleTeamInterface
, public ICogSampleTargetableInterface
, public ICogSampleDamageableInterface
{
GENERATED_BODY()
@@ -118,6 +133,14 @@ public:
virtual void GetTargetCapsules(TArray<const UCapsuleComponent*>& Capsules) const override;
//----------------------------------------------------------------------------------------------------------------------
// ICogSampleDamageableInterface overrides
//----------------------------------------------------------------------------------------------------------------------
virtual void HandleDamageReceived(const FCogSampleDamageEventParams& Params) override;
virtual void HandleDamageDealt(const FCogSampleDamageEventParams& Params) override;
//----------------------------------------------------------------------------------------------------------------------
// Team
//----------------------------------------------------------------------------------------------------------------------
@@ -182,16 +205,12 @@ public:
UFUNCTION(BlueprintPure)
bool IsInitialized() const { return bIsInitialized; }
void HandleDamageReceived(const FCogSampleDamageEventParams& Params);
void HandleDamageDealt(const FCogSampleDamageEventParams& Params);
void OnKilled(AActor* InInstigator, AActor* InCauser, const FGameplayEffectSpec& InEffectSpec, float InMagnitude);
void OnRevived(AActor* InInstigator, AActor* InCauser, const FGameplayEffectSpec& InEffectSpec, float InMagnitude);
UPROPERTY(BlueprintReadOnly, Category = Ability, meta = (AllowPrivateAccess = "true"))
UAbilitySystemComponent* AbilitySystem = nullptr;
UCogSampleAbilitySystemComponent* AbilitySystem = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
TArray<TSubclassOf<UAttributeSet>> AttributeSets;
@@ -229,6 +248,15 @@ public:
UFUNCTION(BlueprintCallable)
int32 ApplyRootMotion(const FCogSampleRootMotionParams& Params);
//----------------------------------------------------------------------------------------------------------------------
// Montage
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Animation", meta = (RowType = "/Script/CogSample.FCogSampleMontageTableRow"))
UDataTable* MontageTable = nullptr;
UFUNCTION(BlueprintCallable, BlueprintPure=false)
bool GetMontage(FName MontageName, UAnimMontage*& Montage, bool bPrintWarning) const;
private:
friend class ACogSamplePlayerController;