:(
This commit is contained in:
30
Source/Aura/Public/AbilitySystem/AuraProjectileSpell.h
Normal file
30
Source/Aura/Public/AbilitySystem/AuraProjectileSpell.h
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright Echo Devgroup
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AbilitySystem/GameplayAbility/AuraGameplayAbility.h"
|
||||
#include "AuraProjectileSpell.generated.h"
|
||||
|
||||
class AAuraProjectile;
|
||||
class UGameplayEffect;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API UAuraProjectileSpell : public UAuraGameplayAbility
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
private:
|
||||
protected:
|
||||
virtual void ActivateAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, const FGameplayEventData* TriggerEventData) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Projectile")
|
||||
void SpawnProjectile(const FVector ProjectileTargetLocation);
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
||||
TSubclassOf<AAuraProjectile> ProjectileClass;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
|
||||
TSubclassOf<UGameplayEffect> DamageEffectClass;
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright Echo Devgroup
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Abilities/GameplayAbility.h"
|
||||
#include "AuraGameplayAbility.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API UAuraGameplayAbility : public UGameplayAbility
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Input")
|
||||
FGameplayTag StartupInputTag;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright Echo Devgroup
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Abilities/Tasks/AbilityTask.h"
|
||||
#include "TargetDataUnderMouse.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMouseTargetDataSignature, const FGameplayAbilityTargetDataHandle&, DataHandle);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API UTargetDataUnderMouse : public UAbilityTask
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, Category = "Ability|Tasks", meta = (DisplayName = "TargetDataUnderMouse", HidePin = "OwningAbility", DefaultToSelf = "OwningAbility", BlueprintInternalUseOnly = true))
|
||||
static UTargetDataUnderMouse* CreateTargetDataUnderMouse(UGameplayAbility* OwningAbility);
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FMouseTargetDataSignature ValidData;
|
||||
|
||||
private:
|
||||
virtual void Activate() override;
|
||||
|
||||
void SendMouseCursorData();
|
||||
};
|
||||
54
Source/Aura/Public/Actor/AuraProjectile.h
Normal file
54
Source/Aura/Public/Actor/AuraProjectile.h
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "GameplayEffectTypes.h"
|
||||
#include "AuraProjectile.generated.h"
|
||||
|
||||
class UNiagaraSystem;
|
||||
class USphereComponent;
|
||||
class UProjectileMovementComponent;
|
||||
|
||||
UCLASS()
|
||||
class AURA_API AAuraProjectile : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AAuraProjectile();
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
TObjectPtr<UProjectileMovementComponent> ProjectileMovement;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, meta = (ExposeOnSpawn = true))
|
||||
FGameplayEffectSpecHandle DamageEffectSpecHandle;
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
virtual void Destroyed() override;
|
||||
|
||||
UFUNCTION()
|
||||
void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
|
||||
private:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float LifeSpan = 15.f;
|
||||
|
||||
bool bHit = false;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
TObjectPtr<USphereComponent> Sphere;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
TObjectPtr<UNiagaraSystem> ImpactEffect;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
TObjectPtr<USoundBase> ImpactSound;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
TObjectPtr<USoundBase> LoopingSound;
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<UAudioComponent> LoopingSoundComponent;
|
||||
};
|
||||
47
Source/Aura/Public/Input/AuraInputComponent.h
Normal file
47
Source/Aura/Public/Input/AuraInputComponent.h
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright Echo Devgroup
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AuraInputConfig.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "AuraInputComponent.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API UAuraInputComponent : public UEnhancedInputComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
template<class UserClass, typename PressedFuncType, typename ReleasedFuncType, typename HeldFuncType>
|
||||
void BindAbilityActions(const UAuraInputConfig* InputConfig, UserClass* Object, PressedFuncType PressedFunc, ReleasedFuncType ReleasedFunc, HeldFuncType HeldFunc);
|
||||
};
|
||||
|
||||
template <class UserClass, typename PressedFuncType, typename ReleasedFuncType, typename HeldFuncType>
|
||||
void UAuraInputComponent::BindAbilityActions(const UAuraInputConfig* InputConfig, UserClass* Object,
|
||||
PressedFuncType PressedFunc, ReleasedFuncType ReleasedFunc, HeldFuncType HeldFunc)
|
||||
{
|
||||
check(InputConfig);
|
||||
|
||||
for (const FAuraInputAction& Action : InputConfig->AbilityInputActions)
|
||||
{
|
||||
if (Action.InputAction && Action.InputTag.IsValid())
|
||||
{
|
||||
if (PressedFunc)
|
||||
{
|
||||
BindAction(Action.InputAction, ETriggerEvent::Started, Object, PressedFunc, Action.InputTag);
|
||||
}
|
||||
if (ReleasedFunc)
|
||||
{
|
||||
BindAction(Action.InputAction, ETriggerEvent::Completed, Object, ReleasedFunc, Action.InputTag);
|
||||
}
|
||||
if (HeldFunc)
|
||||
{
|
||||
BindAction(Action.InputAction, ETriggerEvent::Triggered, Object, HeldFunc, Action.InputTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Source/Aura/Public/Input/AuraInputConfig.h
Normal file
37
Source/Aura/Public/Input/AuraInputConfig.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright Echo Devgroup
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "AuraInputConfig.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FAuraInputAction
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
const class UInputAction* InputAction = nullptr;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
FGameplayTag InputTag = FGameplayTag();
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API UAuraInputConfig : public UDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
const UInputAction* FindAbilityInputActionForTag(const FGameplayTag& InputTag, bool bLogNotFound = false) const;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
|
||||
TArray<FAuraInputAction> AbilityInputActions;
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user