:(
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user