diff --git a/Content/Characters/Crunch/Animation/AnimBP_Crunch.uasset b/Content/Characters/Crunch/Animation/AnimBP_Crunch.uasset index df3d258..e322e73 100644 --- a/Content/Characters/Crunch/Animation/AnimBP_Crunch.uasset +++ b/Content/Characters/Crunch/Animation/AnimBP_Crunch.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7c0c093f7d19b4d2f07fce17e77c20789774d279ba056a6c199e07b16e521a0 -size 360965 +oid sha256:2cef014a0bb099872b617ccaab9654a385ca11ff7730b3f9136d0b0fde61dea0 +size 366042 diff --git a/Content/Characters/Crunch/Animation/CR_Crunch_IKFoot.uasset b/Content/Characters/Crunch/Animation/CR_Crunch_IKFoot.uasset index c692ffb..de31b9e 100644 --- a/Content/Characters/Crunch/Animation/CR_Crunch_IKFoot.uasset +++ b/Content/Characters/Crunch/Animation/CR_Crunch_IKFoot.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:653418fd778266fb8f45bd5b489601b0d1e1442c7935e0ba488b9d815c6ee0a0 -size 557467 +oid sha256:75d222d4259a29bf0b1f4974408d12b1a4a9c4e0398d609de8f552731ed97886 +size 560174 diff --git a/Content/Characters/Crunch/GameplayAbility/Combo/Animations/AM_ComboCrunch.uasset b/Content/Characters/Crunch/GameplayAbility/Combo/Animations/AM_ComboCrunch.uasset new file mode 100644 index 0000000..1653f8b --- /dev/null +++ b/Content/Characters/Crunch/GameplayAbility/Combo/Animations/AM_ComboCrunch.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:642ef8a5f2307a501d2e94c67fbb891447d7fe0843c753b99f5167b38b16767c +size 10591 diff --git a/Content/Characters/Crunch/GameplayAbility/Combo/GA_Combo_Crunch_BP.uasset b/Content/Characters/Crunch/GameplayAbility/Combo/GA_Combo_Crunch_BP.uasset new file mode 100644 index 0000000..06d93da --- /dev/null +++ b/Content/Characters/Crunch/GameplayAbility/Combo/GA_Combo_Crunch_BP.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f50e9312137c22ad7be52e207869b9fb97f4e48b0a1054f8b7dc10ad38fc9a9 +size 16538 diff --git a/Content/Player/CPlayerCharacter_BP.uasset b/Content/Player/CPlayerCharacter_BP.uasset index 4c0e0e9..1b17222 100644 --- a/Content/Player/CPlayerCharacter_BP.uasset +++ b/Content/Player/CPlayerCharacter_BP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6f3de6c95738c0ff0c8a46da49dbb45dae7a69f50e64ad84a4d713f1ac9a102d -size 31785 +oid sha256:cc9b3e36eac8f4064f0b4929deac68a2b097d610483441f13a883eafc52cc91d +size 45292 diff --git a/Source/Crunch/Private/Character/CCharacter.cpp b/Source/Crunch/Private/Character/CCharacter.cpp index cab2ba4..f559b11 100644 --- a/Source/Crunch/Private/Character/CCharacter.cpp +++ b/Source/Crunch/Private/Character/CCharacter.cpp @@ -35,6 +35,7 @@ void ACCharacter::ServerSideInit() { CAbilitySystemComponent->InitAbilityActorInfo(this, this); CAbilitySystemComponent->ApplyInitialEffects(); + CAbilitySystemComponent->GiveInitialAbilities(); } void ACCharacter::ClientSideInit() diff --git a/Source/Crunch/Private/GAS/CAbilitySystemComponent.cpp b/Source/Crunch/Private/GAS/CAbilitySystemComponent.cpp index 34096e3..5e06c3c 100644 --- a/Source/Crunch/Private/GAS/CAbilitySystemComponent.cpp +++ b/Source/Crunch/Private/GAS/CAbilitySystemComponent.cpp @@ -19,3 +19,18 @@ void UCAbilitySystemComponent::ApplyInitialEffects() ApplyGameplayEffectSpecToSelf(*GameplayEffectSpecHandle.Data.Get()); } } + +void UCAbilitySystemComponent::GiveInitialAbilities() +{ + if (!GetOwner() || !GetOwner()->HasAuthority()) return; + + for (const auto& AbilityClass : Abilities) + { + GiveAbility(FGameplayAbilitySpec(AbilityClass, 0, -1, nullptr)); + } + + for (const auto& AbilityClass : BasicAbilities) + { + GiveAbility(FGameplayAbilitySpec(AbilityClass, 1, -1, nullptr)); + } +} diff --git a/Source/Crunch/Private/GAS/CGameplayAbility.cpp b/Source/Crunch/Private/GAS/CGameplayAbility.cpp new file mode 100644 index 0000000..5de57f9 --- /dev/null +++ b/Source/Crunch/Private/GAS/CGameplayAbility.cpp @@ -0,0 +1,4 @@ +// Multiplayer By Caleb + + +#include "GAS/CGameplayAbility.h" diff --git a/Source/Crunch/Private/GAS/GA_Combo.cpp b/Source/Crunch/Private/GAS/GA_Combo.cpp new file mode 100644 index 0000000..e291f24 --- /dev/null +++ b/Source/Crunch/Private/GAS/GA_Combo.cpp @@ -0,0 +1,31 @@ +// Multiplayer By Caleb + + +#include "GAS/GA_Combo.h" + +#include "Abilities/Tasks/AbilityTask_PlayMontageAndWait.h" + +void UGA_Combo::ActivateAbility(const FGameplayAbilitySpecHandle Handle, + const FGameplayAbilityActorInfo* ActorInfo, + const FGameplayAbilityActivationInfo ActivationInfo, + const FGameplayEventData* TriggerEventData) +{ + Super::ActivateAbility(Handle, ActorInfo, ActivationInfo, TriggerEventData); + // if (!CommitAbility(Handle, ActorInfo, ActivationInfo)) // this works as well + if (!K2_CommitAbility()) + { + K2_EndAbility(); + return; + } + if (HasAuthorityOrPredictionKey(ActorInfo, &ActivationInfo)) + { + const auto PlayComboMontage{ + UAbilityTask_PlayMontageAndWait::CreatePlayMontageAndWaitProxy(this, NAME_None, ComboMontage) + }; + PlayComboMontage->OnBlendOut.AddDynamic(this, &UGA_Combo::K2_EndAbility); + PlayComboMontage->OnCancelled.AddDynamic(this, &UGA_Combo::K2_EndAbility); + PlayComboMontage->OnCompleted.AddDynamic(this, &UGA_Combo::K2_EndAbility); + PlayComboMontage->OnInterrupted.AddDynamic(this, &UGA_Combo::K2_EndAbility); + PlayComboMontage->ReadyForActivation(); + } +} diff --git a/Source/Crunch/Public/GAS/CAbilitySystemComponent.h b/Source/Crunch/Public/GAS/CAbilitySystemComponent.h index c039c56..d0669d8 100644 --- a/Source/Crunch/Public/GAS/CAbilitySystemComponent.h +++ b/Source/Crunch/Public/GAS/CAbilitySystemComponent.h @@ -14,8 +14,15 @@ class CRUNCH_API UCAbilitySystemComponent : public UAbilitySystemComponent public: void ApplyInitialEffects(); + void GiveInitialAbilities(); private: UPROPERTY(EditDefaultsOnly, Category="Gameplay Effects") TArray> InitialEffects; + + UPROPERTY(EditDefaultsOnly, Category="Gameplay Ability") + TArray> Abilities; + + UPROPERTY(EditDefaultsOnly, Category="Gameplay Ability") + TArray> BasicAbilities; }; diff --git a/Source/Crunch/Public/GAS/CGameplayAbility.h b/Source/Crunch/Public/GAS/CGameplayAbility.h new file mode 100644 index 0000000..5484a8b --- /dev/null +++ b/Source/Crunch/Public/GAS/CGameplayAbility.h @@ -0,0 +1,16 @@ +// Multiplayer By Caleb + +#pragma once + +#include "CoreMinimal.h" +#include "Abilities/GameplayAbility.h" +#include "CGameplayAbility.generated.h" + +/** + * + */ +UCLASS() +class CRUNCH_API UCGameplayAbility : public UGameplayAbility +{ + GENERATED_BODY() +}; diff --git a/Source/Crunch/Public/GAS/GA_Combo.h b/Source/Crunch/Public/GAS/GA_Combo.h new file mode 100644 index 0000000..a47bd8c --- /dev/null +++ b/Source/Crunch/Public/GAS/GA_Combo.h @@ -0,0 +1,21 @@ +// Multiplayer By Caleb + +#pragma once + +#include "CoreMinimal.h" +#include "CGameplayAbility.h" +#include "GA_Combo.generated.h" + +/** + * + */ +UCLASS() +class CRUNCH_API UGA_Combo : public UCGameplayAbility +{ + GENERATED_BODY() +public: + virtual void ActivateAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, const FGameplayEventData* TriggerEventData) override; +private: + UPROPERTY(EditDefaultsOnly, Category="Amination") + TObjectPtr ComboMontage; +};