added playing animMontage from AbilitySystemComponent
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
Content/Characters/Crunch/GameplayAbility/Combo/Animations/AM_ComboCrunch.uasset
LFS
Normal file
BIN
Content/Characters/Crunch/GameplayAbility/Combo/Animations/AM_ComboCrunch.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/Characters/Crunch/GameplayAbility/Combo/GA_Combo_Crunch_BP.uasset
LFS
Normal file
BIN
Content/Characters/Crunch/GameplayAbility/Combo/GA_Combo_Crunch_BP.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
@@ -35,6 +35,7 @@ void ACCharacter::ServerSideInit()
|
|||||||
{
|
{
|
||||||
CAbilitySystemComponent->InitAbilityActorInfo(this, this);
|
CAbilitySystemComponent->InitAbilityActorInfo(this, this);
|
||||||
CAbilitySystemComponent->ApplyInitialEffects();
|
CAbilitySystemComponent->ApplyInitialEffects();
|
||||||
|
CAbilitySystemComponent->GiveInitialAbilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACCharacter::ClientSideInit()
|
void ACCharacter::ClientSideInit()
|
||||||
|
|||||||
@@ -19,3 +19,18 @@ void UCAbilitySystemComponent::ApplyInitialEffects()
|
|||||||
ApplyGameplayEffectSpecToSelf(*GameplayEffectSpecHandle.Data.Get());
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
4
Source/Crunch/Private/GAS/CGameplayAbility.cpp
Normal file
4
Source/Crunch/Private/GAS/CGameplayAbility.cpp
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// Multiplayer By Caleb
|
||||||
|
|
||||||
|
|
||||||
|
#include "GAS/CGameplayAbility.h"
|
||||||
31
Source/Crunch/Private/GAS/GA_Combo.cpp
Normal file
31
Source/Crunch/Private/GAS/GA_Combo.cpp
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,8 +14,15 @@ class CRUNCH_API UCAbilitySystemComponent : public UAbilitySystemComponent
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void ApplyInitialEffects();
|
void ApplyInitialEffects();
|
||||||
|
void GiveInitialAbilities();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditDefaultsOnly, Category="Gameplay Effects")
|
UPROPERTY(EditDefaultsOnly, Category="Gameplay Effects")
|
||||||
TArray<TSubclassOf<UGameplayEffect>> InitialEffects;
|
TArray<TSubclassOf<UGameplayEffect>> InitialEffects;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Category="Gameplay Ability")
|
||||||
|
TArray<TSubclassOf<UGameplayAbility>> Abilities;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Category="Gameplay Ability")
|
||||||
|
TArray<TSubclassOf<UGameplayAbility>> BasicAbilities;
|
||||||
};
|
};
|
||||||
|
|||||||
16
Source/Crunch/Public/GAS/CGameplayAbility.h
Normal file
16
Source/Crunch/Public/GAS/CGameplayAbility.h
Normal file
@@ -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()
|
||||||
|
};
|
||||||
21
Source/Crunch/Public/GAS/GA_Combo.h
Normal file
21
Source/Crunch/Public/GAS/GA_Combo.h
Normal file
@@ -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<UAnimMontage> ComboMontage;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user