CogSample: improve shooting ability (still wip)

This commit is contained in:
Arnaud Jamin
2023-11-11 00:47:43 -05:00
parent a4362bfbb0
commit 988b048bde
26 changed files with 46 additions and 4 deletions
@@ -19,6 +19,4 @@ public:
UFUNCTION(BlueprintCallable, Category = "GameplayCue", Meta = (AutoCreateRefTerm = "GameplayCueParameters", GameplayTagFilter = "GameplayCue"))
void RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters& GameplayCueParameters) const;
};
+16 -1
View File
@@ -294,6 +294,8 @@ void ACogSampleCharacter::InitializeAbilitySystem()
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::RegisterToAbilitySystemEvents()
{
GameplayTagPropertyMap.Initialize(this, AbilitySystem);
//----------------------------------------
// Register to Tag change events
//----------------------------------------
@@ -858,4 +860,17 @@ bool ACogSampleCharacter::GetMontage(FName MontageName, UAnimMontage*& Montage,
Montage = Row->Montage;
return Montage != nullptr;
}
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::SetIsAiming(bool Value)
{
if (bIsAiming == Value)
{
return;
}
bIsAiming = Value;
OnAimingChanged.Broadcast(this, bIsAiming);
}
+30 -1
View File
@@ -1,5 +1,7 @@
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemInterface.h"
#include "ActiveGameplayEffectHandle.h"
#include "AttributeSet.h"
@@ -10,11 +12,12 @@
#include "CogSampleProgressionLevelInterface.h"
#include "CogSampleTargetableInterface.h"
#include "CogSampleTeamInterface.h"
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "GameplayAbilitySpecHandle.h"
#include "GameplayEffectTypes.h"
#include "GameplayTagContainer.h"
#include "InputActionValue.h"
#include "CogSampleCharacter.generated.h"
class UCameraComponent;
@@ -74,6 +77,7 @@ public:
//--------------------------------------------------------------------------------------------------------------------------
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCogSampleCharacterEventDelegate, ACogSampleCharacter*, Character);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FCogSampleAimingChangedEventDelegate, ACogSampleCharacter*, Character, bool, IsAiming);
//--------------------------------------------------------------------------------------------------------------------------
UCLASS(config=Game)
@@ -144,6 +148,19 @@ public:
virtual bool IsDead() const override;
//----------------------------------------------------------------------------------------------------------------------
// Aiming
//----------------------------------------------------------------------------------------------------------------------
UFUNCTION(BlueprintCallable)
virtual void SetIsAiming(bool Value);
UFUNCTION(BlueprintPure)
virtual bool GetIsAiming() const { return bIsAiming; }
UPROPERTY(BlueprintAssignable)
FCogSampleAimingChangedEventDelegate OnAimingChanged;
//----------------------------------------------------------------------------------------------------------------------
// Team
//----------------------------------------------------------------------------------------------------------------------
@@ -166,6 +183,7 @@ public:
//----------------------------------------------------------------------------------------------------------------------
// Camera
//----------------------------------------------------------------------------------------------------------------------
USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
UCameraComponent* GetFollowCamera() const { return FollowCamera; }
@@ -179,6 +197,7 @@ public:
//----------------------------------------------------------------------------------------------------------------------
// Input
//----------------------------------------------------------------------------------------------------------------------
FVector TransformInputInWorldSpace(const FVector& Input) const;
FVector GetMoveInput() const { return MoveInput; }
@@ -280,6 +299,9 @@ protected:
UPROPERTY()
AController* InitialController = nullptr;
UPROPERTY(EditDefaultsOnly, Category = "GameplayTags")
FGameplayTagBlueprintPropertyMap GameplayTagPropertyMap;
//----------------------------------------------------------------------------------------------------------------------
// Inputs
//----------------------------------------------------------------------------------------------------------------------
@@ -358,5 +380,12 @@ protected:
void Client_ApplyRootMotion(const FCogSampleRootMotionParams& Params);
uint16 ApplyRootMotionShared(const FCogSampleRootMotionParams& Params);
//----------------------------------------------------------------------------------------------------------------------
// Aiming
//----------------------------------------------------------------------------------------------------------------------
bool bIsAiming = false;
};