forked from iniside/ActionRPGGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding missing files from last folder reorganizaion
- Loading branch information
Showing
402 changed files
with
31,181 additions
and
0 deletions.
There are no files selected for viewing
610 changes: 610 additions & 0 deletions
610
Plugins/AbilityFramework/Source/AbilityFramework/Private/AFAbilityComponent.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
Plugins/AbilityFramework/Source/AbilityFramework/Private/AFAbilityInterface.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. | ||
|
||
#include "AbilityFramework.h" | ||
#include "AFAbilityInterface.h" | ||
#include "AFAbilityComponent.h" | ||
#include "AFEffectsComponent.h" | ||
#include "AFAttributeComponent.h" | ||
UAFAbilityInterface::UAFAbilityInterface(const FObjectInitializer& ObjectInitializer) | ||
: Super(ObjectInitializer) | ||
{ | ||
} | ||
|
||
//class UGAAttributesBase* IAFAbilityInterface::GetAttributes() | ||
//{ | ||
// return nullptr;// GetAbilityComp()->DefaultAttributes; | ||
//} | ||
|
||
FGAEffectHandle IAFAbilityInterface::ApplyEffectToTarget( | ||
const FGAEffect& EffectIn | ||
, const FGAEffectHandle& InHandle | ||
, const FAFEffectParams& Params | ||
, const FAFFunctionModifier& Modifier) | ||
{ | ||
return GetEffectsComponent()->ApplyEffectToTarget(EffectIn, InHandle, Params, Modifier); | ||
} |
226 changes: 226 additions & 0 deletions
226
Plugins/AbilityFramework/Source/AbilityFramework/Private/AFAbilityTypes.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "AbilityFramework.h" | ||
#include "AFAbilityComponent.h" | ||
#include "Abilities/GAAbilityBase.h" | ||
#include "AFAbilityTypes.h" | ||
|
||
void FAFAbilityItem::PreReplicatedRemove(const struct FAFAbilityContainer& InArraySerializer) | ||
{ | ||
if (InArraySerializer.AbilitiesComp.IsValid()) | ||
{ | ||
FAFAbilityContainer& InArraySerializerC = const_cast<FAFAbilityContainer&>(InArraySerializer); | ||
//remove attributes | ||
//UGAAttributesBase* attr = InArraySerializer.AbilitiesComp->RepAttributes.AttributeMap.FindRef(Ability->AbilityTag); | ||
Ability->Attributes = nullptr; | ||
InArraySerializerC.AbilityToAction.Remove(AbilityClass); | ||
InArraySerializerC.AbilitiesInputs.Remove(AbilityClass); | ||
InArraySerializerC.TagToAbility.Remove(AbilityClass); | ||
} | ||
} | ||
void FAFAbilityItem::PostReplicatedAdd(const struct FAFAbilityContainer& InArraySerializer) | ||
{ | ||
if (InArraySerializer.AbilitiesComp.IsValid()) | ||
{ | ||
//should be safe, since we only modify the non replicated part of struct. | ||
FAFAbilityContainer& InArraySerializerC = const_cast<FAFAbilityContainer&>(InArraySerializer); | ||
Ability->AbilityComponent = InArraySerializer.AbilitiesComp.Get(); | ||
if (InArraySerializer.AbilitiesComp.IsValid()) | ||
{ | ||
APawn* POwner = Cast<APawn>(InArraySerializer.AbilitiesComp->GetOwner()); | ||
Ability->POwner = POwner; | ||
Ability->PCOwner = Cast<APlayerController>(POwner->Controller); | ||
Ability->OwnerCamera = nullptr; | ||
} | ||
Ability->InitAbility(); | ||
Ability->Attributes = nullptr; | ||
|
||
//TODO - CHANGE ATTRIBUTE HANDLING | ||
UGAAttributesBase* attr = InArraySerializer.AbilitiesComp->RepAttributes.AttributeMap.FindRef(Ability->AbilityTag); | ||
Ability->Attributes = attr; | ||
|
||
InArraySerializerC.AbilitiesInputs.Add(AbilityClass, Ability); //.Add(Ability->AbilityTag, Ability); | ||
InArraySerializerC.TagToAbility.Add(AbilityClass, Ability); | ||
InArraySerializerC.AbilitiesComp->NotifyOnAbilityReady(AbilityClass); | ||
} | ||
} | ||
void FAFAbilityItem::PostReplicatedChange(const struct FAFAbilityContainer& InArraySerializer) | ||
{ | ||
|
||
} | ||
|
||
|
||
void FAFAbilityContainer::SetBlockedInput(const FGameplayTag& InActionName, bool bBlock) | ||
{ | ||
if (BlockedInput.Contains(InActionName)) | ||
{ | ||
BlockedInput[InActionName] = bBlock; | ||
} | ||
else | ||
{ | ||
BlockedInput.Add(InActionName, bBlock); | ||
} | ||
} | ||
UGAAbilityBase* FAFAbilityContainer::AddAbility(TSubclassOf<class UGAAbilityBase> AbilityIn | ||
, TSoftClassPtr<class UGAAbilityBase> InClassPtr) | ||
{ | ||
if (AbilityIn && AbilitiesComp.IsValid()) | ||
{ | ||
|
||
UGAAbilityBase* ability = NewObject<UGAAbilityBase>(AbilitiesComp->GetOwner(), AbilityIn); | ||
ability->AbilityComponent = AbilitiesComp.Get(); | ||
if (AbilitiesComp.IsValid()) | ||
{ | ||
APawn* POwner = Cast<APawn>(AbilitiesComp->GetOwner()); | ||
ability->POwner = POwner; | ||
ability->PCOwner = Cast<APlayerController>(POwner->Controller); | ||
ability->OwnerCamera = nullptr; | ||
} | ||
ability->InitAbility(); | ||
FGameplayTag Tag = ability->AbilityTag; | ||
|
||
AbilitiesInputs.Add(InClassPtr, ability); | ||
FAFAbilityItem AbilityItem(ability, InClassPtr); | ||
MarkItemDirty(AbilityItem); | ||
AbilityItem.Ability = ability; | ||
AbilitiesItems.Add(AbilityItem); | ||
TagToAbility.Add(InClassPtr, ability); | ||
|
||
MarkArrayDirty(); | ||
if (AbilitiesComp->GetNetMode() == ENetMode::NM_Standalone | ||
|| AbilitiesComp->GetOwnerRole() == ENetRole::ROLE_Authority) | ||
{ | ||
AbilitiesComp->NotifyOnAbilityReady(InClassPtr); | ||
} | ||
/* if (ActionName.IsValid()) | ||
{ | ||
UInputComponent* InputComponent = AbilitiesComp->GetOwner()->FindComponentByClass<UInputComponent>(); | ||
AbilitiesComp->BindAbilityToAction(InputComponent, ActionName, Tag); | ||
}*/ | ||
return ability; | ||
} | ||
return nullptr; | ||
} | ||
void FAFAbilityContainer::RemoveAbility(const TSoftClassPtr<UGAAbilityBase>& AbilityIn) | ||
{ | ||
int32 Index = AbilitiesItems.IndexOfByKey(AbilityIn); | ||
|
||
if (Index == INDEX_NONE) | ||
return; | ||
|
||
UGAAbilityBase* Ability = TagToAbility.FindRef(AbilityIn); | ||
|
||
|
||
for (auto It = Ability->AbilityTasks.CreateIterator(); It; ++It) | ||
{ | ||
AbilitiesComp->ReplicatedTasks.Remove(It->Value); | ||
} | ||
Ability->AbilityTasks.Reset(); | ||
|
||
AbilityToAction.Remove(AbilityIn); | ||
AbilitiesInputs.Remove(AbilityIn); | ||
TagToAbility.Remove(AbilityIn); | ||
MarkItemDirty(AbilitiesItems[Index]); | ||
AbilitiesItems.RemoveAt(Index); | ||
MarkArrayDirty(); | ||
} | ||
TSoftClassPtr<UGAAbilityBase> FAFAbilityContainer::IsAbilityBoundToAction(const FGameplayTag& InInputTag) | ||
{ | ||
TSoftClassPtr<UGAAbilityBase> Ability; | ||
TSoftClassPtr<UGAAbilityBase>* AbilityTag = ActionToAbility.Find(InInputTag); | ||
if (AbilityTag) | ||
{ | ||
Ability = *AbilityTag; | ||
} | ||
|
||
return Ability; | ||
} | ||
|
||
void FAFAbilityContainer::SetAbilityToAction(const TSoftClassPtr<UGAAbilityBase>& InAbiltyPtr, const TArray<FGameplayTag>& InInputTag) | ||
{ | ||
for (const FGameplayTag& InputTag : InInputTag) | ||
{ | ||
TSoftClassPtr<UGAAbilityBase>& AbilityClassPtr = ActionToAbility.FindOrAdd(InputTag); | ||
AbilityClassPtr = InAbiltyPtr; | ||
TArray<FGameplayTag>& ActionTag = AbilityToAction.FindOrAdd(InAbiltyPtr); | ||
ActionTag.Add(InputTag); | ||
} | ||
if (!AbilitiesComp.IsValid()) | ||
return; | ||
|
||
UGAAbilityBase* Ability = TagToAbility.FindRef(InAbiltyPtr); | ||
if (Ability) | ||
{ | ||
Ability->OnAbilityInputReady(); | ||
} | ||
|
||
if (AbilitiesComp->GetOwner()->GetNetMode() == ENetMode::NM_DedicatedServer) | ||
{ | ||
AbilitiesComp->ClientNotifyAbilityInputReady(InAbiltyPtr); | ||
} | ||
} | ||
void FAFAbilityContainer::RemoveAbilityFromAction(const TSoftClassPtr<UGAAbilityBase>& InAbiltyPtr) | ||
{ | ||
TArray<FGameplayTag>* Inputs = AbilityToAction.Find(InAbiltyPtr); | ||
|
||
if (Inputs) | ||
{ | ||
for (const FGameplayTag& Input : *Inputs) | ||
{ | ||
ActionToAbility.Remove(Input); | ||
} | ||
|
||
AbilityToAction.Remove(InAbiltyPtr); | ||
} | ||
} | ||
UGAAbilityBase* FAFAbilityContainer::GetAbility(TSoftClassPtr<UGAAbilityBase> InAbiltyPtr) | ||
{ | ||
UGAAbilityBase* retAbility = AbilitiesInputs.FindRef(InAbiltyPtr); | ||
return retAbility; | ||
} | ||
void FAFAbilityContainer::HandleInputPressed(FGameplayTag ActionName, const FAFPredictionHandle& InPredictionHandle) | ||
{ | ||
if (BlockedInput.FindRef(ActionName)) | ||
{ | ||
return; | ||
} | ||
TSoftClassPtr<UGAAbilityBase> AbiltyPtr = ActionToAbility.FindRef(ActionName); | ||
UGAAbilityBase* ability = AbilitiesInputs.FindRef(AbiltyPtr); | ||
if (ability) | ||
{ | ||
if (ability->IsWaitingForConfirm()) | ||
{ | ||
ability->ConfirmAbility(); | ||
return; | ||
} | ||
ability->OnNativeInputPressed(ActionName, InPredictionHandle); | ||
} | ||
} | ||
void FAFAbilityContainer::HandleInputReleased(FGameplayTag ActionName) | ||
{ | ||
if (BlockedInput.FindRef(ActionName)) | ||
{ | ||
return; | ||
} | ||
TSoftClassPtr<UGAAbilityBase> abilityTag = ActionToAbility.FindRef(ActionName); | ||
UGAAbilityBase* ability = AbilitiesInputs.FindRef(abilityTag); | ||
if (ability) | ||
{ | ||
ability->OnNativeInputReleased(ActionName); | ||
} | ||
} | ||
|
||
void FAFAbilityContainer::TriggerAbylityByTag(TSoftClassPtr<UGAAbilityBase> InTag) | ||
{ | ||
UGAAbilityBase* ability = AbilitiesInputs.FindRef(InTag); | ||
if (ability) | ||
{ | ||
if (ability->IsWaitingForConfirm()) | ||
{ | ||
ability->ConfirmAbility(); | ||
return; | ||
} | ||
FAFPredictionHandle PredHandle = FAFPredictionHandle::GenerateClientHandle(AbilitiesComp.Get()); | ||
ability->OnNativeInputPressed(FGameplayTag(), PredHandle); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Plugins/AbilityFramework/Source/AbilityFramework/Private/AFAttributeComponent.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "AbilityFramework.h" | ||
#include "AFAttributeComponent.h" | ||
|
||
|
||
// Sets default values for this component's properties | ||
UAFAttributeComponent::UAFAttributeComponent() | ||
{ | ||
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features | ||
// off to improve performance if you don't need them. | ||
PrimaryComponentTick.bCanEverTick = true; | ||
|
||
// ... | ||
} | ||
|
||
|
||
// Called when the game starts | ||
void UAFAttributeComponent::BeginPlay() | ||
{ | ||
Super::BeginPlay(); | ||
|
||
// ... | ||
|
||
} | ||
|
||
|
||
// Called every frame | ||
void UAFAttributeComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) | ||
{ | ||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction); | ||
|
||
// ... | ||
} | ||
|
46 changes: 46 additions & 0 deletions
46
Plugins/AbilityFramework/Source/AbilityFramework/Private/AFBlueprintFunctionLibrary.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. | ||
|
||
#include "AbilityFramework.h" | ||
|
||
#include "Abilities/GAAbilityBase.h" | ||
#include "Effects/GAEffectField.h" | ||
#include "AFAbilityInterface.h" | ||
#include "AFAbilityComponent.h" | ||
#include "AFBlueprintFunctionLibrary.h" | ||
|
||
void UAFBlueprintFunctionLibrary::TriggerAbilityPressedByTag(UObject* Target, | ||
const FGameplayTag& AbilityTag, FGameplayTag ActionTag) | ||
{ | ||
IAFAbilityInterface* Interface = Cast<IAFAbilityInterface>(Target); | ||
if (!Interface) | ||
{ | ||
UE_LOG(AbilityFramework, Log, TEXT("TriggerAbilityPressedByTag: Invalid Target")); | ||
return; | ||
} | ||
UAFAbilityComponent* Comp = Interface->GetAbilityComp(); | ||
if (!Comp) | ||
{ | ||
UE_LOG(AbilityFramework, Log, TEXT("TriggerAbilityPressedByTag: Target %s InvalidComponent"), *Target->GetName()); | ||
return; | ||
} | ||
|
||
Comp->NativeInputPressed(ActionTag); | ||
} | ||
void UAFBlueprintFunctionLibrary::TriggerAbilityReleasedByTag(UObject* Target, | ||
const FGameplayTag& AbilityTag, FGameplayTag ActionTag) | ||
{ | ||
IAFAbilityInterface* Interface = Cast<IAFAbilityInterface>(Target); | ||
if (!Interface) | ||
{ | ||
UE_LOG(AbilityFramework, Log, TEXT("TriggerAbilityReleasedByTag: Invalid Target")); | ||
return; | ||
} | ||
UAFAbilityComponent* Comp = Interface->GetAbilityComp(); | ||
if (!Comp) | ||
{ | ||
UE_LOG(AbilityFramework, Log, TEXT("TriggerAbilityReleasedByTag: Target %s InvalidComponent"), *Target->GetName()); | ||
return; | ||
} | ||
|
||
Comp->NativeInputReleased(ActionTag); | ||
} |
7 changes: 7 additions & 0 deletions
7
Plugins/AbilityFramework/Source/AbilityFramework/Private/AFCueInterface.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "AbilityFramework.h" | ||
#include "AFCueInterface.h" | ||
|
||
|
||
// Add default functionality here for any IAFCueInterface functions that are not pure virtual. |
Oops, something went wrong.