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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.
@@ -19,6 +19,4 @@ public:
UFUNCTION(BlueprintCallable, Category = "GameplayCue", Meta = (AutoCreateRefTerm = "GameplayCueParameters", GameplayTagFilter = "GameplayCue")) UFUNCTION(BlueprintCallable, Category = "GameplayCue", Meta = (AutoCreateRefTerm = "GameplayCueParameters", GameplayTagFilter = "GameplayCue"))
void RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters& GameplayCueParameters) const; void RemoveGameplayCueLocal(const FGameplayTag GameplayCueTag, const FGameplayCueParameters& GameplayCueParameters) const;
}; };
+16 -1
View File
@@ -294,6 +294,8 @@ void ACogSampleCharacter::InitializeAbilitySystem()
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
void ACogSampleCharacter::RegisterToAbilitySystemEvents() void ACogSampleCharacter::RegisterToAbilitySystemEvents()
{ {
GameplayTagPropertyMap.Initialize(this, AbilitySystem);
//---------------------------------------- //----------------------------------------
// Register to Tag change events // Register to Tag change events
//---------------------------------------- //----------------------------------------
@@ -858,4 +860,17 @@ bool ACogSampleCharacter::GetMontage(FName MontageName, UAnimMontage*& Montage,
Montage = Row->Montage; Montage = Row->Montage;
return Montage != nullptr; 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 #pragma once
#include "CoreMinimal.h"
#include "AbilitySystemInterface.h" #include "AbilitySystemInterface.h"
#include "ActiveGameplayEffectHandle.h" #include "ActiveGameplayEffectHandle.h"
#include "AttributeSet.h" #include "AttributeSet.h"
@@ -10,11 +12,12 @@
#include "CogSampleProgressionLevelInterface.h" #include "CogSampleProgressionLevelInterface.h"
#include "CogSampleTargetableInterface.h" #include "CogSampleTargetableInterface.h"
#include "CogSampleTeamInterface.h" #include "CogSampleTeamInterface.h"
#include "CoreMinimal.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "GameplayAbilitySpecHandle.h" #include "GameplayAbilitySpecHandle.h"
#include "GameplayEffectTypes.h"
#include "GameplayTagContainer.h" #include "GameplayTagContainer.h"
#include "InputActionValue.h" #include "InputActionValue.h"
#include "CogSampleCharacter.generated.h" #include "CogSampleCharacter.generated.h"
class UCameraComponent; class UCameraComponent;
@@ -74,6 +77,7 @@ public:
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCogSampleCharacterEventDelegate, ACogSampleCharacter*, Character); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCogSampleCharacterEventDelegate, ACogSampleCharacter*, Character);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FCogSampleAimingChangedEventDelegate, ACogSampleCharacter*, Character, bool, IsAiming);
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
UCLASS(config=Game) UCLASS(config=Game)
@@ -144,6 +148,19 @@ public:
virtual bool IsDead() const override; 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 // Team
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@@ -166,6 +183,7 @@ public:
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Camera // Camera
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
USpringArmComponent* GetCameraBoom() const { return CameraBoom; } USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
UCameraComponent* GetFollowCamera() const { return FollowCamera; } UCameraComponent* GetFollowCamera() const { return FollowCamera; }
@@ -179,6 +197,7 @@ public:
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Input // Input
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
FVector TransformInputInWorldSpace(const FVector& Input) const; FVector TransformInputInWorldSpace(const FVector& Input) const;
FVector GetMoveInput() const { return MoveInput; } FVector GetMoveInput() const { return MoveInput; }
@@ -280,6 +299,9 @@ protected:
UPROPERTY() UPROPERTY()
AController* InitialController = nullptr; AController* InitialController = nullptr;
UPROPERTY(EditDefaultsOnly, Category = "GameplayTags")
FGameplayTagBlueprintPropertyMap GameplayTagPropertyMap;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// Inputs // Inputs
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@@ -358,5 +380,12 @@ protected:
void Client_ApplyRootMotion(const FCogSampleRootMotionParams& Params); void Client_ApplyRootMotion(const FCogSampleRootMotionParams& Params);
uint16 ApplyRootMotionShared(const FCogSampleRootMotionParams& Params); uint16 ApplyRootMotionShared(const FCogSampleRootMotionParams& Params);
//----------------------------------------------------------------------------------------------------------------------
// Aiming
//----------------------------------------------------------------------------------------------------------------------
bool bIsAiming = false;
}; };