Modified application of startup data
parent
3160d68a46
commit
085d8e3906
|
|
@ -6,7 +6,7 @@
|
||||||
#include "AbilitySystemComponent.h"
|
#include "AbilitySystemComponent.h"
|
||||||
#include "VRGASUtils.h"
|
#include "VRGASUtils.h"
|
||||||
|
|
||||||
void UVRStartupAbilitySystemData::GiveToAbilitySystemComponent(UAbilitySystemComponent* InAbilitySystemComponent, int32 ApplyLevel)
|
void UVRStartupAbilitySystemData::GiveToAbilitySystemComponent(UAbilitySystemComponent* InAbilitySystemComponent, int32 ApplyLevel) const
|
||||||
{
|
{
|
||||||
check(InAbilitySystemComponent)
|
check(InAbilitySystemComponent)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,28 @@ UVRAbilitySystemComponent::UVRAbilitySystemComponent(const FObjectInitializer& O
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma region Startup
|
||||||
void UVRAbilitySystemComponent::ApplyStartupData()
|
void UVRAbilitySystemComponent::ApplyStartupData()
|
||||||
{
|
{
|
||||||
if (StartupData)
|
if (StartupData)
|
||||||
{
|
{
|
||||||
StartupData->GiveToAbilitySystemComponent(this, DefaultStartingAbilityLevel);
|
StartupData->GiveToAbilitySystemComponent(this, DefaultStartingAbilityLevel);
|
||||||
|
bStartupAbilitiesGiven = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UE_LOG(VRGAS_Log, Error, TEXT("UVRAbilitySystemComponent::ApplyStartupData - No Startup Data found!"))
|
UE_LOG(VRGAS_Log, Error, TEXT("UVRAbilitySystemComponent::ApplyStartupData - No Startup Data found!"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UVRAbilitySystemComponent::ApplyExternalStartupData(const UVRStartupAbilitySystemData* InStartupData, const uint32 InStartingAbilityLevel)
|
||||||
|
{
|
||||||
|
check(InStartupData);
|
||||||
|
|
||||||
|
InStartupData->GiveToAbilitySystemComponent(this, InStartingAbilityLevel);
|
||||||
|
bStartupAbilitiesGiven = true;
|
||||||
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma region Input
|
||||||
void UVRAbilitySystemComponent::InputTagPressed(FGameplayTag& InTag)
|
void UVRAbilitySystemComponent::InputTagPressed(FGameplayTag& InTag)
|
||||||
{
|
{
|
||||||
if (!InTag.IsValid()) return;
|
if (!InTag.IsValid()) return;
|
||||||
|
|
@ -164,5 +176,5 @@ void UVRAbilitySystemComponent::AbilitySpecInputReleased(FGameplayAbilitySpec& S
|
||||||
InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputReleased, Spec.Handle, Spec.ActivationInfo.GetActivationPredictionKey());
|
InvokeReplicatedEvent(EAbilityGenericReplicatedEvent::InputReleased, Spec.Handle, Spec.ActivationInfo.GetActivationPredictionKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class VRGAS_API UVRStartupAbilitySystemData : public UDataAsset
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Gives abilities and ability sets to the target ASC, as well as applies the attribute initializer gameplay effect
|
// Gives abilities and ability sets to the target ASC, as well as applies the attribute initializer gameplay effect
|
||||||
virtual void GiveToAbilitySystemComponent(UAbilitySystemComponent* InAbilitySystemComponent, int32 ApplyLevel = 1);
|
virtual void GiveToAbilitySystemComponent(UAbilitySystemComponent* InAbilitySystemComponent, int32 ApplyLevel = 1) const;
|
||||||
|
|
||||||
// Add accessors as needed
|
// Add accessors as needed
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "AbilitySystemComponent.h"
|
#include "AbilitySystemComponent.h"
|
||||||
|
#include "StartupData/VRStartupAbilitySystemData.h"
|
||||||
#include "VRAbilitySystemComponent.generated.h"
|
#include "VRAbilitySystemComponent.generated.h"
|
||||||
|
|
||||||
// DECLARE_MULTICAST_DELEGATE_OneParam(FEffectAssetTags, const FGameplayTagContainer& /*AssetTags*/);
|
// DECLARE_MULTICAST_DELEGATE_OneParam(FEffectAssetTags, const FGameplayTagContainer& /*AssetTags*/);
|
||||||
|
|
@ -24,11 +25,18 @@ public:
|
||||||
|
|
||||||
// FEffectAssetTags EffectAssetTags;
|
// FEffectAssetTags EffectAssetTags;
|
||||||
// FAbilitiesGiven OnAbilitiesGiven;
|
// FAbilitiesGiven OnAbilitiesGiven;
|
||||||
#pragma region PublicStartup
|
#pragma region Startup
|
||||||
UPROPERTY(BlueprintReadOnly, Category = "Startup Data")
|
UPROPERTY(BlueprintReadOnly, Category = "StartupData")
|
||||||
bool bStartupAbilitiesGiven = false;
|
bool bStartupAbilitiesGiven = false;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "StartupData")
|
||||||
|
TObjectPtr<UVRStartupAbilitySystemData> StartupData;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "StartupData", meta = (ClampMin = 1))
|
||||||
|
int DefaultStartingAbilityLevel = 1;
|
||||||
|
|
||||||
virtual void ApplyStartupData();
|
virtual void ApplyStartupData();
|
||||||
|
virtual void ApplyExternalStartupData(const UVRStartupAbilitySystemData* InStartupData, const uint32 InStartingAbilityLevel = 1);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
// Add startup abilities
|
// Add startup abilities
|
||||||
|
|
@ -58,11 +66,4 @@ protected:
|
||||||
TArray<FGameplayAbilitySpecHandle> InputHeldSpecHandles;
|
TArray<FGameplayAbilitySpecHandle> InputHeldSpecHandles;
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region ProtectedStartup
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Startup Data")
|
|
||||||
TObjectPtr<UVRStartupAbilitySystemData> StartupData;
|
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Startup Data", meta = (ClampMin = 1))
|
|
||||||
int DefaultStartingAbilityLevel = 1;
|
|
||||||
#pragma endregion
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue