add a new heroes push back abilities

This commit is contained in:
Arnaud Jamin
2023-10-05 01:54:26 -04:00
parent ad397dbf7e
commit 27f4b9485a
73 changed files with 1077 additions and 233 deletions
+63 -9
View File
@@ -5,7 +5,8 @@
#include "ActiveGameplayEffectHandle.h"
#include "AttributeSet.h"
#include "CogDefines.h"
#include "CogInterfaceFilteredActor.h"
#include "CogInterfaceAllegianceActor.h"
#include "CogInterfaceDebugFilteredActor.h"
#include "GameFramework/Character.h"
#include "GameplayAbilitySpecHandle.h"
#include "GameplayTagContainer.h"
@@ -21,9 +22,21 @@ class UInputAction;
class UInputMappingContext;
class USpringArmComponent;
struct FActiveGameplayEffect;
struct FCogSampleForcedMoveParams;
struct FGameplayEffectSpec;
struct FOnAttributeChangeData;
//--------------------------------------------------------------------------------------------------------------------------
UENUM(BlueprintType, meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))
enum class ECogSampleAllegianceFilter : uint8
{
None = 0 UMETA(Hidden),
Ally = 1 << 0,
Neutral = 1 << 1,
Enemy = 1 << 2,
};
ENUM_CLASS_FLAGS(ECogSampleAllegianceFilter);
//--------------------------------------------------------------------------------------------------------------------------
USTRUCT(BlueprintType)
struct FActiveAbilityInfo
@@ -57,7 +70,8 @@ public:
UCLASS(config=Game)
class ACogSampleCharacter : public ACharacter
, public IAbilitySystemInterface
, public ICogInterfacesFilteredActor
, public ICogInterfacesDebugFilteredActor
, public ICogInterfacesAllegianceActor
{
GENERATED_BODY()
@@ -83,6 +97,11 @@ public:
UFUNCTION(BlueprintPure)
UAbilitySystemComponent* GetAbilitySystemComponent() const override;
//----------------------------------------------------------------------------------------------------------------------
// ICogInterfacesAllegianceActor overrides
//----------------------------------------------------------------------------------------------------------------------
ECogInterfacesAllegiance GetAllegianceWithOtherActor(const AActor* OtherActor) const override;
//----------------------------------------------------------------------------------------------------------------------
void OnAcknowledgePossession(APlayerController* InController);
@@ -94,13 +113,13 @@ public:
void OnRevived(AActor* InInstigator, AActor* InCauser, const FGameplayEffectSpec& InEffectSpec, float InMagnitude);
//----------------------------------------------------------------------------------------------------------------------
// Camera
//----------------------------------------------------------------------------------------------------------------------
USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
UCameraComponent* GetFollowCamera() const { return FollowCamera; }
//----------------------------------------------------------------------------------------------------------------------
// Camera
//----------------------------------------------------------------------------------------------------------------------
/** Camera boom positioning the camera behind the character */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
USpringArmComponent* CameraBoom;
@@ -157,12 +176,30 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
TArray<TSubclassOf<UGameplayEffect>> Effects;
//----------------------------------------------------------------------------------------------------------------------
// Team
//----------------------------------------------------------------------------------------------------------------------
UFUNCTION(BlueprintPure)
int32 GetTeamID() const { return TeamID; }
UFUNCTION(BlueprintCallable)
void SetTeamID(int32 Value);
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Team, Replicated, meta = (AllowPrivateAccess = "true"))
int32 TeamID = 0;
//----------------------------------------------------------------------------------------------------------------------
// Forced Move
//----------------------------------------------------------------------------------------------------------------------
UFUNCTION(BlueprintCallable)
int32 ApplyForcedMove(const FCogSampleForcedMoveParams& Params);
private:
void InitializeAbilitySystem();
void ShutdownAbilitySystem();
//----------------------------------------------------------------------------------------------------------------------
// Inputs
//----------------------------------------------------------------------------------------------------------------------
void Move(const FInputActionValue& Value);
void MoveZ(const FInputActionValue& Value);
@@ -175,6 +212,13 @@ private:
void ActivateItem(const FInputActionValue& Value, int32 Index);
//----------------------------------------------------------------------------------------------------------------------
// Ability system
//----------------------------------------------------------------------------------------------------------------------
void InitializeAbilitySystem();
void ShutdownAbilitySystem();
void OnGameplayEffectAdded(UAbilitySystemComponent* AbilitySystemComponent, const FGameplayEffectSpec& GameplayEffectSpec, FActiveGameplayEffectHandle Handle);
void OnGameplayEffectRemoved(const FActiveGameplayEffect& RemovedGameplayEffect);
@@ -183,6 +227,15 @@ private:
void OnScaleAttributeChanged(const FOnAttributeChangeData& Data);
//----------------------------------------------------------------------------------------------------------------------
// Forced Move
//----------------------------------------------------------------------------------------------------------------------
UFUNCTION(Reliable, Client)
void Client_ApplyForcedMove(const FCogSampleForcedMoveParams& Params);
uint16 ApplyForcedMoveInternal(const FCogSampleForcedMoveParams& Params);
//----------------------------------------------------------------------------------------------------------------------
UPROPERTY(Replicated, Transient)
TArray<FGameplayAbilitySpecHandle> ActiveAbilityHandles;
@@ -197,5 +250,6 @@ private:
bool bIsGhost = false;
bool bIsInitialized = false;
};