From a82d78f0fbadc4949a7e3afd4b9d04a0d16743dd Mon Sep 17 00:00:00 2001 From: HappyTanuki Date: Mon, 30 Oct 2023 00:04:36 +0900 Subject: [PATCH] =?UTF-8?q?GAS=20=EC=A0=81=EC=9A=A9=EC=8B=9C=EB=8F=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/DefaultGameplayTags.ini | 14 +- Config/DefaultInput.ini | 2 + Content/Blueprints/BP_Deathmatch.uasset | 3 + .../BP_DefaultPlayerCharacter.uasset | 4 +- .../Bp_DefaultplayerController.uasset | 4 +- .../UI/NameBar_UI/NameBar_UI.uasset | 4 +- .../Lb/Abilities/BP_BaseAttack.uasset | 3 - .../Character/Lb/Ability/BP_BaseAttack.uasset | 3 + Content/Character/Lb/BP_Lb.uasset | 4 +- .../InputActions/InputMappingContext.uasset | 4 +- Content/InputActions/Skill1.uasset | 4 +- Content/InputActions/Skill2.uasset | 4 +- Content/InputActions/Skill3.uasset | 4 +- Content/InputActions/Skill4.uasset | 4 +- Content/InputActions/Skill4_End.uasset | 3 - Content/Maps/DeathmatchMap.umap | 4 +- Source/Promether/AnimNotify/AN_AnimEnd.cpp | 4 +- Source/Promether/AnimNotify/AN_Attack.cpp | 2 +- Source/Promether/AnimNotify/AN_Skill1.cpp | 2 +- Source/Promether/AnimNotify/AN_Skill2.cpp | 2 +- Source/Promether/AnimNotify/AN_Skill3.cpp | 2 +- Source/Promether/AnimNotify/AN_Skill4.cpp | 2 +- Source/Promether/DefaultAIController.cpp | 5 + Source/Promether/DefaultGameInstance.cpp | 56 +++ Source/Promether/DefaultGameInstance.h | 19 + .../Abilities/CharacterGameplayAbility.cpp | 18 + .../GAS/Abilities/CharacterGameplayAbility.h | 15 +- .../AttributeSet/CharacterBaseAttribute.cpp | 12 + .../GAS/AttributeSet/CharacterBaseAttribute.h | 12 + .../GAS/DefaultAbilitySystemComponent.cpp | 176 ++++++++ .../GAS/DefaultAbilitySystemComponent.h | 47 ++- Source/Promether/GameModeBase/Deathmatch.cpp | 3 +- .../PlayerGeneric/DefaultAnimBPBase.cpp | 3 + .../PlayerGeneric/DefaultPlayerCharacter.cpp | 392 ++++++++++-------- .../PlayerGeneric/DefaultPlayerCharacter.h | 162 +++----- .../PlayerGeneric/DefaultPlayerController.cpp | 298 +++---------- .../PlayerGeneric/DefaultPlayerController.h | 32 +- .../PlayerGeneric/DefaultPlayerState.cpp | 147 ++++--- .../PlayerGeneric/DefaultPlayerState.h | 67 +-- Source/Promether/Promether.h | 6 +- 40 files changed, 859 insertions(+), 693 deletions(-) create mode 100644 Content/Blueprints/BP_Deathmatch.uasset delete mode 100644 Content/Character/Lb/Abilities/BP_BaseAttack.uasset create mode 100644 Content/Character/Lb/Ability/BP_BaseAttack.uasset delete mode 100644 Content/InputActions/Skill4_End.uasset diff --git a/Config/DefaultGameplayTags.ini b/Config/DefaultGameplayTags.ini index fb2bf5b..726d96c 100644 --- a/Config/DefaultGameplayTags.ini +++ b/Config/DefaultGameplayTags.ini @@ -5,9 +5,19 @@ ClearInvalidTags=False AllowEditorTagUnloading=True AllowGameTagUnloading=False FastReplication=False -InvalidTagCharacters="\"\'," +InvalidTagCharacters= NumBitsForContainerSize=6 NetIndexFirstBitSegment=16 ++GameplayTagList=(Tag="State.Buff.Regenerate.Health",DevComment="") ++GameplayTagList=(Tag="State.Buff.Regenerate.Mana",DevComment="") ++GameplayTagList=(Tag="State.Buff.Shield",DevComment="") +GameplayTagList=(Tag="State.Dead",DevComment="") -+GameplayTagList=(Tag="State.EffectTag",DevComment="") ++GameplayTagList=(Tag="State.Debuff.Burning",DevComment="") ++GameplayTagList=(Tag="State.Debuff.Root",DevComment="") ++GameplayTagList=(Tag="State.Debuff.Slow",DevComment="") ++GameplayTagList=(Tag="State.Debuff.Stun",DevComment="") ++GameplayTagList=(Tag="State.Return",DevComment="") ++GameplayTagList=(Tag="Team.Black",DevComment="") ++GameplayTagList=(Tag="Team.Neutral",DevComment="") ++GameplayTagList=(Tag="Team.White",DevComment="") diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index 4cc3605..0022561 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -67,7 +67,9 @@ bCaptureMouseOnLaunch=True bEnableLegacyInputScales=True bEnableMotionControls=True bFilterInputByPlatformUser=False +bEnableInputDeviceSubsystem=True bShouldFlushPressedKeysOnViewportFocusLost=True +bEnableDynamicComponentInputBinding=True bAlwaysShowTouchInterface=False bShowConsoleOnFourFingerTap=True bEnableGestureRecognizer=False diff --git a/Content/Blueprints/BP_Deathmatch.uasset b/Content/Blueprints/BP_Deathmatch.uasset new file mode 100644 index 0000000..7a501f6 --- /dev/null +++ b/Content/Blueprints/BP_Deathmatch.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4db6c4af2a8800920fd4ac6fd9a68fac9f9c38da240481727d8afe1365a7800d +size 19174 diff --git a/Content/Blueprints/BP_DefaultPlayerCharacter.uasset b/Content/Blueprints/BP_DefaultPlayerCharacter.uasset index 8b8a483..8b67c6a 100644 --- a/Content/Blueprints/BP_DefaultPlayerCharacter.uasset +++ b/Content/Blueprints/BP_DefaultPlayerCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8c82415960d0b58adbb46faa76b95711bf913a53aab55b722faaf06b86922c0 -size 142183 +oid sha256:08407ae245e5a1ca5a20ef549eb7078ea86a3264af854743d70e78f61c7572fb +size 38885 diff --git a/Content/Blueprints/Bp_DefaultplayerController.uasset b/Content/Blueprints/Bp_DefaultplayerController.uasset index a3dcecb..fd7f6c7 100644 --- a/Content/Blueprints/Bp_DefaultplayerController.uasset +++ b/Content/Blueprints/Bp_DefaultplayerController.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35c948e04afb8c14af8946eaaaf737ad665fec4b70ed70b46d3150a4e450485b -size 12861 +oid sha256:dffae311796a2ed27dc281868c2e4eb1be384fbbb19acebc880cea9cbda72305 +size 41021 diff --git a/Content/Blueprints/UI/NameBar_UI/NameBar_UI.uasset b/Content/Blueprints/UI/NameBar_UI/NameBar_UI.uasset index bbe456e..b63a23e 100644 --- a/Content/Blueprints/UI/NameBar_UI/NameBar_UI.uasset +++ b/Content/Blueprints/UI/NameBar_UI/NameBar_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95ff3173214888843cc310bd0246f36ee5c3e72356588bc16792ec06b01ae6c8 -size 81747 +oid sha256:2699582c196330adf270186f16d96f7d701d13818797e1e5c0652feb94880914 +size 79109 diff --git a/Content/Character/Lb/Abilities/BP_BaseAttack.uasset b/Content/Character/Lb/Abilities/BP_BaseAttack.uasset deleted file mode 100644 index c4b95b9..0000000 --- a/Content/Character/Lb/Abilities/BP_BaseAttack.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c2584a5a086fb10778e20f238a7c7275a8062b7ccb38e2f835785616c12a6813 -size 14879 diff --git a/Content/Character/Lb/Ability/BP_BaseAttack.uasset b/Content/Character/Lb/Ability/BP_BaseAttack.uasset new file mode 100644 index 0000000..d57b3d3 --- /dev/null +++ b/Content/Character/Lb/Ability/BP_BaseAttack.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59a6f8c3fdfe105bed4f088b1d4eb57ad89095830d5fd712b1c8649d0ee43a16 +size 29368 diff --git a/Content/Character/Lb/BP_Lb.uasset b/Content/Character/Lb/BP_Lb.uasset index 18e899f..909d806 100644 --- a/Content/Character/Lb/BP_Lb.uasset +++ b/Content/Character/Lb/BP_Lb.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9f36f2e488c952b8af6c0d15c66ae12e281d5a610fadb3246c6fc5cff50c9ae -size 256191 +oid sha256:ad71da8c7182c6407ac9f99fea02916d95b57cff920f926dfea8f5051b379d10 +size 34829 diff --git a/Content/InputActions/InputMappingContext.uasset b/Content/InputActions/InputMappingContext.uasset index 0b5099e..5f62c33 100644 --- a/Content/InputActions/InputMappingContext.uasset +++ b/Content/InputActions/InputMappingContext.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:211d2c26d7a5c53a14ae7319d4c76917bfbd6f94785c13468fb2e6857a6a1b19 -size 10912 +oid sha256:32cafa9b232530ba4cb2e6d8932983937d75be92c9f7ead82637315fbeb7e730 +size 8401 diff --git a/Content/InputActions/Skill1.uasset b/Content/InputActions/Skill1.uasset index 8880b79..6f1969d 100644 --- a/Content/InputActions/Skill1.uasset +++ b/Content/InputActions/Skill1.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd8912cbf5419a26dff0f5fb5fcdaca972ffb3defaa6aa9363989a51750216b6 -size 1323 +oid sha256:0e24273c5032d1a93b3e112e839a30a1db94b96cc16638246167aaf395223afd +size 1000 diff --git a/Content/InputActions/Skill2.uasset b/Content/InputActions/Skill2.uasset index 87b9502..83f14c2 100644 --- a/Content/InputActions/Skill2.uasset +++ b/Content/InputActions/Skill2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a8f77afc5c7c01aadad7bfe8c031733bd67cc9e1ecb6858012270b243f30a1ae -size 1323 +oid sha256:39b577db1d0eb4e22c122c4fee558c2544518ca77ca05e84f792bff30c1b3890 +size 1000 diff --git a/Content/InputActions/Skill3.uasset b/Content/InputActions/Skill3.uasset index 89403cc..bc514d8 100644 --- a/Content/InputActions/Skill3.uasset +++ b/Content/InputActions/Skill3.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b510bfdd89859a1f2691eb704b58266dbe531d717ef3af037eb5e0b6e8ef7c3c -size 1323 +oid sha256:77c08410891958f5d713f8b380347213c4823787db812d7e1117e03154f581a8 +size 1000 diff --git a/Content/InputActions/Skill4.uasset b/Content/InputActions/Skill4.uasset index a177354..318f33d 100644 --- a/Content/InputActions/Skill4.uasset +++ b/Content/InputActions/Skill4.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f316965e3f12b135169cd83fd7accf644205ab51b48d81efbc93dd401ebd0bd -size 1392 +oid sha256:4bdbe4d5f16516a6a6a5adb74993b74e18f6514fa608bb7b08f2a6b22636cdca +size 1069 diff --git a/Content/InputActions/Skill4_End.uasset b/Content/InputActions/Skill4_End.uasset deleted file mode 100644 index 6bec5f9..0000000 --- a/Content/InputActions/Skill4_End.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9b7cb2a0d4b9554f2e40b924c03423f726bf79276780a1adb8ca4a38138f1857 -size 1343 diff --git a/Content/Maps/DeathmatchMap.umap b/Content/Maps/DeathmatchMap.umap index 8f6b9e6..608439c 100644 --- a/Content/Maps/DeathmatchMap.umap +++ b/Content/Maps/DeathmatchMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4254ab06a72e192fcedce031103cff65da5d9e5ca65276ae6f32025c5b532bdc -size 155324 +oid sha256:123eeb19502fabcf5179af503796e16371b7f0279bfbc02939da436c04ecce12 +size 154492 diff --git a/Source/Promether/AnimNotify/AN_AnimEnd.cpp b/Source/Promether/AnimNotify/AN_AnimEnd.cpp index 053f104..83c9825 100644 --- a/Source/Promether/AnimNotify/AN_AnimEnd.cpp +++ b/Source/Promether/AnimNotify/AN_AnimEnd.cpp @@ -9,11 +9,13 @@ void UAN_AnimEnd::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) { + // TODO - animation state update fix + /* ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); if (!MyCharacter) return; ADefaultPlayerState* MyState = MyCharacter->GetPlayerState(); if (!MyState) return; MyState->SetState(ECharacterState::Idle); - + */ } diff --git a/Source/Promether/AnimNotify/AN_Attack.cpp b/Source/Promether/AnimNotify/AN_Attack.cpp index 7070d73..811399b 100644 --- a/Source/Promether/AnimNotify/AN_Attack.cpp +++ b/Source/Promether/AnimNotify/AN_Attack.cpp @@ -11,5 +11,5 @@ void UAN_Attack::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Ani ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); if (!MyCharacter) return; - MyCharacter->Attack(); + // MyCharacter->Attack(); Replace later } \ No newline at end of file diff --git a/Source/Promether/AnimNotify/AN_Skill1.cpp b/Source/Promether/AnimNotify/AN_Skill1.cpp index 08d26ee..27435d1 100644 --- a/Source/Promether/AnimNotify/AN_Skill1.cpp +++ b/Source/Promether/AnimNotify/AN_Skill1.cpp @@ -10,5 +10,5 @@ void UAN_Skill1::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Ani ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); if (!MyCharacter) return; - MyCharacter->Skill1(); + // MyCharacter->Skill1(); Replace later } diff --git a/Source/Promether/AnimNotify/AN_Skill2.cpp b/Source/Promether/AnimNotify/AN_Skill2.cpp index 9ebf7b2..d704871 100644 --- a/Source/Promether/AnimNotify/AN_Skill2.cpp +++ b/Source/Promether/AnimNotify/AN_Skill2.cpp @@ -10,5 +10,5 @@ void UAN_Skill2::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Ani ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); if (!MyCharacter) return; - MyCharacter->Skill2(); + // MyCharacter->Skill2(); Replace later } diff --git a/Source/Promether/AnimNotify/AN_Skill3.cpp b/Source/Promether/AnimNotify/AN_Skill3.cpp index 8c2b5e7..2833acc 100644 --- a/Source/Promether/AnimNotify/AN_Skill3.cpp +++ b/Source/Promether/AnimNotify/AN_Skill3.cpp @@ -10,5 +10,5 @@ void UAN_Skill3::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Ani ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); if (!MyCharacter) return; - MyCharacter->Skill3(); + // MyCharacter->Skill3(); Replace later } diff --git a/Source/Promether/AnimNotify/AN_Skill4.cpp b/Source/Promether/AnimNotify/AN_Skill4.cpp index e73362a..6e5d5e7 100644 --- a/Source/Promether/AnimNotify/AN_Skill4.cpp +++ b/Source/Promether/AnimNotify/AN_Skill4.cpp @@ -10,5 +10,5 @@ void UAN_Skill4::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Ani ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); if (!MyCharacter) return; - MyCharacter->Skill4(); + // MyCharacter->Skill4(); Replace later } diff --git a/Source/Promether/DefaultAIController.cpp b/Source/Promether/DefaultAIController.cpp index 5f680d8..f678e1c 100644 --- a/Source/Promether/DefaultAIController.cpp +++ b/Source/Promether/DefaultAIController.cpp @@ -12,6 +12,10 @@ ADefaultAIController::ADefaultAIController() void ADefaultAIController::OnPossess(APawn* aPawn) { + /* + * + * This was Stat initialize code. Depricated. + //debug FString MyName = aPawn->GetName(); @@ -30,4 +34,5 @@ void ADefaultAIController::OnPossess(APawn* aPawn) ControlledPawn->CooldownDuration.GenerateValueArray(CooldownDurationValue); MyPlayerState->InitPlayerStats(DefaultStatsValue, CooldownDurationValue); + */ } \ No newline at end of file diff --git a/Source/Promether/DefaultGameInstance.cpp b/Source/Promether/DefaultGameInstance.cpp index c49b9e5..858d18e 100644 --- a/Source/Promether/DefaultGameInstance.cpp +++ b/Source/Promether/DefaultGameInstance.cpp @@ -10,6 +10,62 @@ UDefaultGameInstance::UDefaultGameInstance() ConstructorHelpers::FObjectFinder RIANA(TEXT("Class'/Game/Character/Riana/BP_Riana.BP_Riana_C'")); ConstructorHelpers::FObjectFinder LB(TEXT("Class'/Game/Character/Lb/BP_Lb.BP_Lb_C'")); + static ConstructorHelpers::FObjectFinder + DEFAULT_CONTEXT(TEXT("/Script/EnhancedInput.InputMappingContext'/Game/InputActions/InputMappingContext.InputMappingContext'")); + if (!DEFAULT_CONTEXT.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("DEFAULT_CONTEXT load failed.")); + return; + } + + PlayerInputMapping = DEFAULT_CONTEXT.Object; + + static ConstructorHelpers::FObjectFinder + IA_RUNESPELL1(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/RuneSpell1.RuneSpell1'")), + IA_RUNESPELL2(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/RuneSpell2.RuneSpell2'")), + IA_WARD(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Ward.Ward'")), + IA_BOMB(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Bomb.Bomb'")), + IA_OBJECTSELECT(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/ObjectSelect.ObjectSelect'")), + IA_MOVE(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Move.Move'")); + + if (!IA_RUNESPELL1.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("IA_RUNESPELL1 load failed.")); + return; + } + if (!IA_RUNESPELL2.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("IA_RUNESPELL2 load failed.")); + return; + } + if (!IA_WARD.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("IA_WARD load failed.")); + return; + } + if (!IA_BOMB.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("IA_BOMB load failed.")); + return; + } + if (!IA_OBJECTSELECT.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("IA_OBJECTSELECT load failed.")); + return; + } + if (!IA_MOVE.Succeeded()) + { + UE_LOG(LogTemp, Error, TEXT("IA_MOVE load failed.")); + return; + } + + RuneSpell1Action = IA_RUNESPELL1.Object; + RuneSpell2Action = IA_RUNESPELL2.Object; + WardAction = IA_WARD.Object; + BombAction = IA_BOMB.Object; + ObjectSelectAction = IA_OBJECTSELECT.Object; + MoveAction = IA_MOVE.Object; + if ( //!LUKRIEL.Succeeded() || diff --git a/Source/Promether/DefaultGameInstance.h b/Source/Promether/DefaultGameInstance.h index 7707e83..38203b7 100644 --- a/Source/Promether/DefaultGameInstance.h +++ b/Source/Promether/DefaultGameInstance.h @@ -5,6 +5,9 @@ #include "CoreMinimal.h" #include "Engine/GameInstance.h" #include "PrometherEnum.h" +#include "EnhancedInputSubsystems.h" +#include "EnhancedInputComponent.h" +#include "InputMappingContext.h" #include "DefaultGameInstance.generated.h" UCLASS() @@ -19,6 +22,22 @@ public: UClass* GetCharacterBPRef(CharacterType Type) { return BP_Characters[(uint8)Type]; } + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr PlayerInputMapping; + + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr RuneSpell1Action; + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr RuneSpell2Action; + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr WardAction; + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr BombAction; + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr ObjectSelectAction; + UPROPERTY(EditAnywhere, Category = "Input") + TSoftObjectPtr MoveAction; + private: UPROPERTY() UClass* BP_Characters[(uint8)CharacterType::SIZE]; diff --git a/Source/Promether/GAS/Abilities/CharacterGameplayAbility.cpp b/Source/Promether/GAS/Abilities/CharacterGameplayAbility.cpp index 6fa6ab8..98f887a 100644 --- a/Source/Promether/GAS/Abilities/CharacterGameplayAbility.cpp +++ b/Source/Promether/GAS/Abilities/CharacterGameplayAbility.cpp @@ -2,4 +2,22 @@ #include "CharacterGameplayAbility.h" +#include "../DefaultAbilitySystemComponent.h" +UCharacterGameplayAbility::UCharacterGameplayAbility() +{ + InstancingPolicy = EGameplayAbilityInstancingPolicy::InstancedPerActor; + + ActivationBlockedTags.AddTag(FGameplayTag::RequestGameplayTag(FName("State.Dead"))); + ActivationBlockedTags.AddTag(FGameplayTag::RequestGameplayTag(FName("State.Debuff.Stun"))); +} + +void UCharacterGameplayAbility::OnAvatarSet(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec) +{ + Super::OnAvatarSet(ActorInfo, Spec); + + if (ActivateAbilityOnGranted) + { + ActorInfo->AbilitySystemComponent->TryActivateAbility(Spec.Handle, false); + } +} diff --git a/Source/Promether/GAS/Abilities/CharacterGameplayAbility.h b/Source/Promether/GAS/Abilities/CharacterGameplayAbility.h index aca7cb9..b8fa393 100644 --- a/Source/Promether/GAS/Abilities/CharacterGameplayAbility.h +++ b/Source/Promether/GAS/Abilities/CharacterGameplayAbility.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "Abilities/GameplayAbility.h" +#include "../../Promether.h" #include "CharacterGameplayAbility.generated.h" /** @@ -13,5 +14,17 @@ UCLASS() class PROMETHER_API UCharacterGameplayAbility : public UGameplayAbility { GENERATED_BODY() - +public: + UCharacterGameplayAbility(); + + UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Ability") + EDefaultAbilityID AbilityID = EDefaultAbilityID::None; + + UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Ability") + EDefaultAbilityID AbilityInputID = EDefaultAbilityID::None; + + UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Ability") + bool ActivateAbilityOnGranted = false; + + virtual void OnAvatarSet(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec) override; }; diff --git a/Source/Promether/GAS/AttributeSet/CharacterBaseAttribute.cpp b/Source/Promether/GAS/AttributeSet/CharacterBaseAttribute.cpp index bfea36c..8e9208d 100644 --- a/Source/Promether/GAS/AttributeSet/CharacterBaseAttribute.cpp +++ b/Source/Promether/GAS/AttributeSet/CharacterBaseAttribute.cpp @@ -8,12 +8,24 @@ void UCharacterBaseAttribute::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; + UPROPERTY(BlueprintReadonly, Category = "Team", ReplicatedUsing = OnRep_Team) + FGameplayAttributeData Team; + ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, Team) + + UPROPERTY(BlueprintReadonly, Category = "XP", ReplicatedUsing = OnRep_XP) + FGameplayAttributeData XP; + ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, XP) + UPROPERTY(BlueprintReadonly, Category = "Health", ReplicatedUsing = OnRep_Health) FGameplayAttributeData Health; ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, Health) @@ -38,6 +46,10 @@ public: FGameplayAttributeData MaxMana; ATTRIBUTE_ACCESSORS(UCharacterBaseAttribute, MaxMana) + UFUNCTION() + virtual void OnRep_Team(const FGameplayAttributeData& OldTeam); + UFUNCTION() + virtual void OnRep_XP(const FGameplayAttributeData& OldXP); UFUNCTION() virtual void OnRep_Health(const FGameplayAttributeData& OldHealth); UFUNCTION() diff --git a/Source/Promether/GAS/DefaultAbilitySystemComponent.cpp b/Source/Promether/GAS/DefaultAbilitySystemComponent.cpp index 38a97d0..8d769f5 100644 --- a/Source/Promether/GAS/DefaultAbilitySystemComponent.cpp +++ b/Source/Promether/GAS/DefaultAbilitySystemComponent.cpp @@ -2,8 +2,184 @@ #include "DefaultAbilitySystemComponent.h" +#include "InputAction.h" +#include "EnhancedInputComponent.h" +#include "AbilitySystemComponent.h" +#include "AbilitySystemGlobals.h" + +namespace EnhancedInputAbilitySystem_Impl +{ + constexpr int32 InvalidInputID = 0; + int32 IncrementingInputID = InvalidInputID; + + static int32 GetNextInputID() + { + return ++IncrementingInputID; + } +} void UDefaultAbilitySystemComponent::ReceiveDamage(UDefaultAbilitySystemComponent* SourceASC, float UnmitigatedDamage, float MitigatedDamage) { ReceivedDamage.ExecuteIfBound(SourceASC, UnmitigatedDamage, MitigatedDamage); } + +void UDefaultAbilitySystemComponent::SetInputBinding(UInputAction* InputAction, FGameplayAbilitySpecHandle AbilityHandle) +{ + using namespace EnhancedInputAbilitySystem_Impl; + + FGameplayAbilitySpec* BindingAbility = FindAbilitySpec(AbilityHandle); + + FAbilityInputBinding* AbilityInputBinding = MappedAbilities.Find(InputAction); + if (AbilityInputBinding) + { + FGameplayAbilitySpec* OldBoundAbility = FindAbilitySpec(AbilityInputBinding->BoundAbilitiesStack.Top()); + if (OldBoundAbility && OldBoundAbility->InputID == AbilityInputBinding->InputID) + { + OldBoundAbility->InputID = InvalidInputID; + } + } + else + { + AbilityInputBinding = &MappedAbilities.Add(InputAction); + AbilityInputBinding->InputID = GetNextInputID(); + } + + if (BindingAbility) + { + BindingAbility->InputID = AbilityInputBinding->InputID; + } + + AbilityInputBinding->BoundAbilitiesStack.Push(AbilityHandle); + TryBindAbilityInput(InputAction, *AbilityInputBinding); +} + +void UDefaultAbilitySystemComponent::ClearInputBinding(FGameplayAbilitySpecHandle AbilityHandle) +{ + using namespace EnhancedInputAbilitySystem_Impl; + + if (FGameplayAbilitySpec* FoundAbility = FindAbilitySpec(AbilityHandle)) + { + // Find the mapping for this ability + auto MappedIterator = MappedAbilities.CreateIterator(); + while (MappedIterator) + { + if (MappedIterator.Value().InputID == FoundAbility->InputID) + { + break; + } + + ++MappedIterator; + } + + if (MappedIterator) + { + FAbilityInputBinding& AbilityInputBinding = MappedIterator.Value(); + + if (AbilityInputBinding.BoundAbilitiesStack.Remove(AbilityHandle) > 0) + { + if (AbilityInputBinding.BoundAbilitiesStack.Num() > 0) + { + FGameplayAbilitySpec* StackedAbility = FindAbilitySpec(AbilityInputBinding.BoundAbilitiesStack.Top()); + if (StackedAbility && StackedAbility->InputID == 0) + { + StackedAbility->InputID = AbilityInputBinding.InputID; + } + } + else + { + // NOTE: This will invalidate the `AbilityInputBinding` ref above + RemoveEntry(MappedIterator.Key()); + } + // DO NOT act on `AbilityInputBinding` after here (it could have been removed) + + + FoundAbility->InputID = InvalidInputID; + } + } + } +} + +void UDefaultAbilitySystemComponent::ClearAbilityBindings(UInputAction* InputAction) +{ + RemoveEntry(InputAction); +} + +void UDefaultAbilitySystemComponent::OnAbilityInputPressed(UInputAction* InputAction) +{ + using namespace EnhancedInputAbilitySystem_Impl; + + FAbilityInputBinding* FoundBinding = MappedAbilities.Find(InputAction); + if (FoundBinding && ensure(FoundBinding->InputID != InvalidInputID)) + { + AbilityLocalInputPressed(FoundBinding->InputID); + } +} + +void UDefaultAbilitySystemComponent::OnAbilityInputReleased(UInputAction* InputAction) +{ + using namespace EnhancedInputAbilitySystem_Impl; + + FAbilityInputBinding* FoundBinding = MappedAbilities.Find(InputAction); + if (FoundBinding && ensure(FoundBinding->InputID != InvalidInputID)) + { + AbilityLocalInputReleased(FoundBinding->InputID); + } +} + +void UDefaultAbilitySystemComponent::RemoveEntry(UInputAction* InputAction) +{ + if (FAbilityInputBinding* Bindings = MappedAbilities.Find(InputAction)) + { + if (InputComponent) + { + InputComponent->RemoveBindingByHandle(Bindings->OnPressedHandle); + InputComponent->RemoveBindingByHandle(Bindings->OnReleasedHandle); + } + + for (FGameplayAbilitySpecHandle AbilityHandle : Bindings->BoundAbilitiesStack) + { + using namespace EnhancedInputAbilitySystem_Impl; + + FGameplayAbilitySpec* AbilitySpec = FindAbilitySpec(AbilityHandle); + if (AbilitySpec && AbilitySpec->InputID == Bindings->InputID) + { + AbilitySpec->InputID = InvalidInputID; + } + } + + MappedAbilities.Remove(InputAction); + } +} + +FGameplayAbilitySpec* UDefaultAbilitySystemComponent::FindAbilitySpec(FGameplayAbilitySpecHandle Handle) +{ + FGameplayAbilitySpec* FoundAbility = nullptr; + FoundAbility = FindAbilitySpecFromHandle(Handle); + return FoundAbility; +} + +void UDefaultAbilitySystemComponent::TryBindAbilityInput(UInputAction* InputAction, FAbilityInputBinding& AbilityInputBinding) +{ + if (InputComponent) + { + // Pressed event + if (AbilityInputBinding.OnPressedHandle == 0) + { + AbilityInputBinding.OnPressedHandle = InputComponent->BindAction(InputAction, ETriggerEvent::Started, this, &UDefaultAbilitySystemComponent::OnAbilityInputPressed, InputAction).GetHandle(); + } + + // Released event + if (AbilityInputBinding.OnReleasedHandle == 0) + { + AbilityInputBinding.OnReleasedHandle = InputComponent->BindAction(InputAction, ETriggerEvent::Completed, this, &UDefaultAbilitySystemComponent::OnAbilityInputReleased, InputAction).GetHandle(); + } + } +} + +void UDefaultAbilitySystemComponent::BeginPlay() { + Super::BeginPlay(); + AActor* Owner = GetOwner(); + if (IsValid(Owner) && Owner->InputComponent) { + InputComponent = CastChecked(Owner->InputComponent); + } +} \ No newline at end of file diff --git a/Source/Promether/GAS/DefaultAbilitySystemComponent.h b/Source/Promether/GAS/DefaultAbilitySystemComponent.h index 1c7cc0e..3e74d2d 100644 --- a/Source/Promether/GAS/DefaultAbilitySystemComponent.h +++ b/Source/Promether/GAS/DefaultAbilitySystemComponent.h @@ -4,17 +4,62 @@ #include "CoreMinimal.h" #include "AbilitySystemComponent.h" +#include "GameplayAbilitySpec.h" +#include "EnhancedInputComponent.h" #include "DefaultAbilitySystemComponent.generated.h" DECLARE_DYNAMIC_DELEGATE_ThreeParams(FReceivedDamageDelegate, UDefaultAbilitySystemComponent*, SourceASC, float, UnmitigatedDamage, float, MitigatedDamage); -UCLASS() +class UInputAction; + +USTRUCT() +struct FAbilityInputBinding +{ + GENERATED_BODY() + + int32 InputID = 0; + uint32 OnPressedHandle = 0; + uint32 OnReleasedHandle = 0; + TArray BoundAbilitiesStack; +}; + +UCLASS(Blueprintable, BlueprintType, Category = "AbilityInput", meta = (BlueprintSpawnableComponent)) class PROMETHER_API UDefaultAbilitySystemComponent : public UAbilitySystemComponent { GENERATED_BODY() public: + bool CharacterAbilitiesGiven = false; + bool StartupEffectsApplied = false; + FReceivedDamageDelegate ReceivedDamage; virtual void ReceiveDamage(UDefaultAbilitySystemComponent* SourceASC, float UnmitigatedDamage, float MitigatedDamage); + UFUNCTION(BlueprintCallable, Category = "Enhanced Input Abilities") + void SetInputBinding(UInputAction* InputAction, FGameplayAbilitySpecHandle AbilityHandle); + + UFUNCTION(BlueprintCallable, Category = "Enhanced Input Abilities") + void ClearInputBinding(FGameplayAbilitySpecHandle AbilityHandle); + + UFUNCTION(BlueprintCallable, Category = "Enhanced Input Abilities") + void ClearAbilityBindings(UInputAction* InputAction); + +private: + void OnAbilityInputPressed(UInputAction* InputAction); + + void OnAbilityInputReleased(UInputAction* InputAction); + + void RemoveEntry(UInputAction* InputAction); + + void TryBindAbilityInput(UInputAction* InputAction, FAbilityInputBinding& AbilityInputBinding); + + FGameplayAbilitySpec* FindAbilitySpec(FGameplayAbilitySpecHandle Handle); + + virtual void BeginPlay() override; + + UPROPERTY(transient) + TMap MappedAbilities; + + UPROPERTY(transient) + UEnhancedInputComponent* InputComponent; }; diff --git a/Source/Promether/GameModeBase/Deathmatch.cpp b/Source/Promether/GameModeBase/Deathmatch.cpp index db8175f..8d340c7 100644 --- a/Source/Promether/GameModeBase/Deathmatch.cpp +++ b/Source/Promether/GameModeBase/Deathmatch.cpp @@ -143,8 +143,7 @@ FString ADeathmatch::InitNewPlayer(APlayerController* NewPlayerController, const if (ADefaultPlayerState* NewPlayerState = NewPlayerController->GetPlayerState()) { NewPlayerState->SetCharacterBPRef(GetGameInstance()->GetCharacterBPRef(Type)); - //NewPlayerState->InitPlayerStats(); - NewPlayerState->SetTeam(Team); + //NewPlayerState->SetTeam(Team); TODO - change to tag base } return ErrorMessage; diff --git a/Source/Promether/PlayerGeneric/DefaultAnimBPBase.cpp b/Source/Promether/PlayerGeneric/DefaultAnimBPBase.cpp index c6317d0..ed74a09 100644 --- a/Source/Promether/PlayerGeneric/DefaultAnimBPBase.cpp +++ b/Source/Promether/PlayerGeneric/DefaultAnimBPBase.cpp @@ -17,8 +17,11 @@ void UDefaultAnimBPBase::NativeUpdateAnimation(float DeltaSeconds) { if (ADefaultPlayerState* MyPlayerState = MyPawn->GetPlayerState()) { + // TODO - animation state update fix + /* State = MyPlayerState->GetState(); AttackType = MyPlayerState->GetAttackType(); + */ /* if (!GPlayInEditorID) diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp index cda6dcb..2406ccd 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp @@ -2,17 +2,34 @@ #include "DefaultPlayerCharacter.h" -#include "DefaultPlayerState.h" +#include "GameFramework/CharacterMovementComponent.h" +#include "EnhancedInputSubsystems.h" +#include "EnhancedInputComponent.h" #include "../DefaultAIController.h" #include "Engine/DamageEvents.h" #include "Kismet/GameplayStatics.h" #include "Components/CapsuleComponent.h" +#include "GameFramework/SpringArmComponent.h" +#include "Camera/CameraComponent.h" +#include "Promether/Promether.h" +#include "Promether/GAS/DefaultAbilitySystemComponent.h" +#include "Promether/GAS/AttributeSet/CharacterBaseAttribute.h" -ADefaultPlayerCharacter::ADefaultPlayerCharacter() +ADefaultPlayerCharacter::ADefaultPlayerCharacter(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName)) { // Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; SetCanBeDamaged(true); + + GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Visibility, ECollisionResponse::ECR_Overlap); + + bAlwaysRelevant = true; + + DeadTag = FGameplayTag::RequestGameplayTag(FName("State.Dead")); + TeamTag = FGameplayTag::RequestGameplayTag(FName("Team.Neutral")); + EffectRemoveOnDeathTag = FGameplayTag::RequestGameplayTag(FName("Status.Buff.Regenerate.Health")); + bUseControllerRotationYaw = false; AIControllerClass = ADefaultAIController::StaticClass(); @@ -29,12 +46,11 @@ ADefaultPlayerCharacter::ADefaultPlayerCharacter() Camera = CreateDefaultSubobject(TEXT("Camera")); Camera->SetupAttachment(CameraSpringArm, USpringArmComponent::SocketName); - - for (uint8 i = 0; i < (uint8)EStats::SIZE; i++) - DefaultStats.Add((EStats)i, 0.0f); +} - for (uint8 i = 0; i < (uint8)CooldownType::SIZE; i++) - CooldownDuration.Add((CooldownType)i, 0.0f); +UAbilitySystemComponent* ADefaultPlayerCharacter::GetAbilitySystemComponent() const +{ + return AbilitySystemComponent.Get(); } void ADefaultPlayerCharacter::Tick(float DeltaTime) @@ -54,173 +70,221 @@ void ADefaultPlayerCharacter::Tick(float DeltaTime) */ } -void ADefaultPlayerCharacter::Attack_Implementation() +void ADefaultPlayerCharacter::PossessedBy(AController* NewController) { - Client_Attack(); - BP_Attack(); -} + Super::PossessedBy(NewController); -void ADefaultPlayerCharacter::Client_Attack_Implementation() -{ - BP_Attack(); -} - -float ADefaultPlayerCharacter::TakeDamage_Implementation(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, AActor* DamageCauser) -{ - float ReturnValue = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser); - - ADefaultPlayerState* State = GetPlayerState(); - if (!State) return ReturnValue; - - if (!Cast(DamageCauser)) return ReturnValue; - - ADefaultPlayerState* AttackerState = Cast(DamageCauser)->GetPlayerState(); - if (!AttackerState) return ReturnValue; - - float ADDamageMultiplier = 0; - float APDamageMultiplier = 0; - - if (State->Stats[(uint8)EStats::Armor] >= 0) - ADDamageMultiplier = 100 / (100 + State->Stats[(uint8)EStats::Armor]); - else - ADDamageMultiplier = 2 - 100 / (100 - State->Stats[(uint8)EStats::Armor]); - - if (State->Stats[(uint8)EStats::MagicResistance] >= 0) - APDamageMultiplier = 100 / (100 + State->Stats[(uint8)EStats::MagicResistance]); - else - APDamageMultiplier = 2 - 100 / (100 - State->Stats[(uint8)EStats::MagicResistance]); - - - UE_LOG(LogTemp, Warning, TEXT("%s : ADDamageMultiplier : %f CalculatedDamage : %f"), *DamageCauser->GetName(), ADDamageMultiplier, DamageAmount * ADDamageMultiplier); - UE_LOG(LogTemp, Warning, TEXT("%s : APDamageMultiplier : %f CalculatedDamage : %f"), *DamageCauser->GetName(), APDamageMultiplier, DamageAmount * APDamageMultiplier); - - float UpdatedHealth = 0; - - if (Cast(DamageEvent.DamageTypeClass->GetDefaultObject())) - { - UE_LOG(LogTemp, Warning, TEXT("DamageType : BaseAttack")); - - UpdatedHealth = State->Stats[(uint8)EStats::Health] - AttackerState->Stats[(uint8)EStats::AttackDamage] * ADDamageMultiplier; - } - else if (Cast(DamageEvent.DamageTypeClass->GetDefaultObject())) - { - UE_LOG(LogTemp, Warning, TEXT("DamageType : APDamage")); - - UpdatedHealth = State->Stats[(uint8)EStats::Health] - AttackerState->Stats[(uint8)EStats::AbilityPower] * APDamageMultiplier; - } - - if (UpdatedHealth < 0 || UpdatedHealth < 0.1 ) - { - State->Stats[(uint8)EStats::Health] = 0; - Server_PerformDead(); - Client_PerformDead(); - } - else - { - State->Stats[(uint8)EStats::Health] = UpdatedHealth; - } - - UE_LOG(LogTemp, Warning, TEXT("Current Health : %f"), State->Stats[(uint8)EStats::Health]); - - return ReturnValue; -} - -void ADefaultPlayerCharacter::Skill1_Implementation() -{ - NetMulticast_Skill1(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill1_Implementation() -{ - BP_Skill1(); -} - -void ADefaultPlayerCharacter::Skill2_Implementation() -{ - NetMulticast_Skill2(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill2_Implementation() -{ - BP_Skill2(); -} - -void ADefaultPlayerCharacter::Skill3_Implementation() -{ - NetMulticast_Skill3(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill3_Implementation() -{ - BP_Skill3(); -} - -void ADefaultPlayerCharacter::Skill4_Implementation() -{ - NetMulticast_Skill4(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill4_Implementation() -{ - BP_Skill4(); -} - -void ADefaultPlayerCharacter::Skill4_End_Implementation() -{ - NetMulticast_Skill4_End(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill4_End_Implementation() -{ - BP_Skill4_End(); -} - -void ADefaultPlayerCharacter::Skill5_Implementation() -{ - NetMulticast_Skill5(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill5_Implementation() -{ - BP_Skill5(); -} - -void ADefaultPlayerCharacter::Skill6_Implementation() -{ - NetMulticast_Skill6(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill6_Implementation() -{ - BP_Skill6(); -} - -void ADefaultPlayerCharacter::Skill7_Implementation() -{ - NetMulticast_Skill7(); -} - -void ADefaultPlayerCharacter::NetMulticast_Skill7_Implementation() -{ - BP_Skill7(); -} - -void ADefaultPlayerCharacter::PerformDead() -{ ADefaultPlayerState* State = GetPlayerState(); if (!State) return; - State->SetState(ECharacterState::Dead); - GetCapsuleComponent()->SetGenerateOverlapEvents(false); + InitializeStartingValues(State); + + AddStartupEffects(); + AddCharacterAbilities(); +} + +bool ADefaultPlayerCharacter::IsDead() const +{ + return GetHealth() < 0.0f; +} + +int32 ADefaultPlayerCharacter::GetAbilityLevel(EDefaultAbilityID AbilityID) const +{ + return 0; +} + +void ADefaultPlayerCharacter::RemoveCharacterAbilities() +{ + if (GetLocalRole() != ROLE_Authority || !AbilitySystemComponent.IsValid() || !AbilitySystemComponent->CharacterAbilitiesGiven) + return; + + TArray AbilitiesToRemove; + for (const FGameplayAbilitySpec& Spec : AbilitySystemComponent->GetActivatableAbilities()) + { + if ((Spec.SourceObject == this) && CharacterAbilities.Contains(Spec.Ability->GetClass())) + { + AbilitiesToRemove.Add(Spec.Handle); + } + } + + for (int32 i = 0; i < AbilitiesToRemove.Num(); i++) + AbilitySystemComponent->ClearAbility(AbilitiesToRemove[i]); + + AbilitySystemComponent->CharacterAbilitiesGiven = false; +} + +void ADefaultPlayerCharacter::beginDead() +{ + RemoveCharacterAbilities(); + GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision); + GetCharacterMovement()->Velocity = FVector(0); + + //OnCharacterDied.ExecuteIfBound(this); + OnCharacterDied.Broadcast(this); + + if (AbilitySystemComponent.IsValid()) + { + AbilitySystemComponent->CancelAbilities(); + + FGameplayTagContainer EffectTagsToRemove; + EffectTagsToRemove.AddTag(EffectRemoveOnDeathTag); + + int32 NumEffectsRemoved = AbilitySystemComponent->RemoveActiveEffectsWithTags(EffectTagsToRemove); + AbilitySystemComponent->AddLooseGameplayTag(DeadTag); + } } -void ADefaultPlayerCharacter::Server_PerformDead_Implementation() +void ADefaultPlayerCharacter::FinishDying() { - PerformDead(); } -void ADefaultPlayerCharacter::Client_PerformDead_Implementation() +float ADefaultPlayerCharacter::GetXP() const { - PerformDead(); + if (Attribute.IsValid()) + return Attribute->GetXP(); + + return 0.0f; +} + +float ADefaultPlayerCharacter::GetCalculatedLevel() const +{ + if (Attribute.IsValid()) + return Attribute->GetXP() / 100.0f; //fix later + + return 0.0f; +} + +float ADefaultPlayerCharacter::GetHealth() const +{ + if (Attribute.IsValid()) + return Attribute->GetHealth(); + + return 0.0f; +} + +float ADefaultPlayerCharacter::GetMaxHealth() const +{ + if (Attribute.IsValid()) + return Attribute->GetMaxHealth(); + + return 0.0f; +} + +float ADefaultPlayerCharacter::GetMana() const +{ + if (Attribute.IsValid()) + return Attribute->GetMana(); + + return 0.0f; +} + +float ADefaultPlayerCharacter::GetMaxMana() const +{ + if (Attribute.IsValid()) + return Attribute->GetMaxMana(); + + return 0.0f; +} + +void ADefaultPlayerCharacter::BeginPlay() +{ + Super::BeginPlay(); +} + +void ADefaultPlayerCharacter::AddCharacterAbilities() +{ + if (GetLocalRole() != ROLE_Authority || !AbilitySystemComponent.IsValid() || AbilitySystemComponent->CharacterAbilitiesGiven) + return; + + for (TSubclassOf& StartupAbility : CharacterAbilities) + { + AbilitySystemComponent->GiveAbility( FGameplayAbilitySpec ( + StartupAbility, + GetAbilityLevel(StartupAbility.GetDefaultObject()->AbilityID), + static_cast(StartupAbility.GetDefaultObject()->AbilityInputID), + this + )); + } + + AbilitySystemComponent->CharacterAbilitiesGiven = true; +} + +void ADefaultPlayerCharacter::InitializeAttributes() +{ + if (!AbilitySystemComponent.IsValid()) + return; + + if (!DefaultAttributes) + { + UE_LOG(LogTemp, Error, TEXT("%s() Missing DefaultAttributes for %s. Please fill in the character's Blueprint."), *FString(__FUNCTION__), *GetName()); + return; + } + + FGameplayEffectContextHandle EffectContext = AbilitySystemComponent->MakeEffectContext(); + EffectContext.AddSourceObject(this); + + FGameplayEffectSpecHandle NewHandle = AbilitySystemComponent->MakeOutgoingSpec(DefaultAttributes, GetCalculatedLevel(), EffectContext); + if (NewHandle.IsValid()) + { + FActiveGameplayEffectHandle ActiveGEHandle = AbilitySystemComponent->ApplyGameplayEffectSpecToTarget(*NewHandle.Data.Get(), AbilitySystemComponent.Get()); + } +} + +void ADefaultPlayerCharacter::AddStartupEffects() +{ + if (GetLocalRole() != ROLE_Authority || !AbilitySystemComponent.IsValid() || AbilitySystemComponent->StartupEffectsApplied) + return; + + FGameplayEffectContextHandle EffectContext = AbilitySystemComponent->MakeEffectContext(); + EffectContext.AddSourceObject(this); + + for (TSubclassOf GameplayEffects : StartupEffects) + { + FGameplayEffectSpecHandle NewHandle = AbilitySystemComponent->MakeOutgoingSpec(GameplayEffects, GetCalculatedLevel(), EffectContext); + if (NewHandle.IsValid()) + { + FActiveGameplayEffectHandle ActiveGEHandle = AbilitySystemComponent->ApplyGameplayEffectSpecToTarget(*NewHandle.Data.Get(), AbilitySystemComponent.Get()); + } + } + + AbilitySystemComponent->StartupEffectsApplied = true; +} + +void ADefaultPlayerCharacter::InitializeStartingValues(ADefaultPlayerState* State) +{ + if (!State) return; + + AbilitySystemComponent = Cast(State->GetAbilitySystemComponent()); + State->GetAbilitySystemComponent()->InitAbilityActorInfo(State, this); + + Attribute = State->GetAttributeSet(); + + AbilitySystemComponent->SetTagMapCount(DeadTag, 0); + + SetHealth(GetMaxHealth()); + SetMana(GetMaxMana()); +} + +void ADefaultPlayerCharacter::SetHealth(float Health) +{ + if (Attribute.IsValid()) + Attribute->SetHealth(Health); +} + +void ADefaultPlayerCharacter::SetMana(float Mana) +{ + if (Attribute.IsValid()) + Attribute->SetHealth(Mana); +} + +void ADefaultPlayerCharacter::OnRep_PlayerState() +{ + Super::OnRep_PlayerState(); + + ADefaultPlayerState* State = GetPlayerState(); + if (!State) return; + + InitializeStartingValues(State); + InitializeAttributes(); } diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h index b5773d2..93be4e8 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h @@ -4,119 +4,93 @@ #include "CoreMinimal.h" #include "GameFramework/Character.h" -#include "GameFramework/SpringArmComponent.h" -#include "Camera/CameraComponent.h" - -#include "../PrometherEnum.h" +#include "GameFramework/CharacterMovementComponent.h" +#include "AbilitySystemInterface.h" +#include "GameplayTagContainer.h" +#include "DefaultPlayerState.h" +#include "../GAS/DefaultAbilitySystemComponent.h" +#include "../GAS/AttributeSet/CharacterBaseAttribute.h" +#include "../GAS/Abilities/CharacterGameplayAbility.h" #include "DefaultPlayerCharacter.generated.h" +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCharacterDiedDelegate, ADefaultPlayerCharacter*, Character); + UCLASS() -class PROMETHER_API ADefaultPlayerCharacter : public ACharacter +class PROMETHER_API ADefaultPlayerCharacter : public ACharacter, public IAbilitySystemInterface { GENERATED_BODY() public: // Sets default values for this character's properties - ADefaultPlayerCharacter(); + ADefaultPlayerCharacter(const class FObjectInitializer& ObjectInitializer); + + virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override; virtual void Tick(float DeltaTime) override; - UFUNCTION(BlueprintCallable, Server, Reliable) - void Attack(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Attack(); - UFUNCTION(Client, Reliable) - void Client_Attack(); + virtual void PossessedBy(AController* NewController) override; - UFUNCTION(BlueprintNativeEvent) - float TakeDamage( float Damage, - struct FDamageEvent const& DamageEvent, - AController* EventInstigator, - AActor* DamageCauser ) override; + UPROPERTY(BlueprintAssignable, Category = "Character") + FCharacterDiedDelegate OnCharacterDied; + UFUNCTION(BlueprintCallable, Category = "Character") + virtual bool IsDead() const; - void PerformDead(); + UFUNCTION(BlueprintCallable, Category = "Character") + virtual int32 GetAbilityLevel(EDefaultAbilityID AbilityID) const; - UFUNCTION(Client, Reliable) - void Client_PerformDead(); + virtual void RemoveCharacterAbilities(); + virtual void beginDead(); - UFUNCTION(Server, Reliable) - void Server_PerformDead(); + UFUNCTION(BlueprintCallable, Category = "Character") + virtual void FinishDying(); + UFUNCTION(BlueprintCallable, Category = "Character|Attribute") + float GetXP() const; + UFUNCTION(BlueprintCallable, Category = "Character|Attribute") + float GetCalculatedLevel() const; + UFUNCTION(BlueprintCallable, Category = "Character|Attribute") + float GetHealth() const; + UFUNCTION(BlueprintCallable, Category = "Character|Attribute") + float GetMaxHealth() const; + UFUNCTION(BlueprintCallable, Category = "Character|Attribute") + float GetMana() const; + UFUNCTION(BlueprintCallable, Category = "Character|Attribute") + float GetMaxMana() const; - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill1(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill1(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill1(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill2(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill2(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill2(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill3(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill3(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill3(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill4(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill4(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill4(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill4_End(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill4_End(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill4_End(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill5(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill5(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill5(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill6(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill6(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill6(); - - UFUNCTION(BlueprintCallable, Server, Reliable) - void Skill7(); - //Override me - UFUNCTION(BlueprintImplementableEvent) - void BP_Skill7(); - UFUNCTION(NetMulticast, Reliable) - void NetMulticast_Skill7(); - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats") - TMap DefaultStats; - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats") - TMap CooldownDuration; protected: + virtual void BeginPlay() override; + + TWeakObjectPtr AbilitySystemComponent; + TWeakObjectPtr Attribute; + + FGameplayTag DeadTag; + FGameplayTag TeamTag; + FGameplayTag EffectRemoveOnDeathTag; + + UPROPERTY(BlueprintReadOnly, EditAnywhere, category = "Abilities") + TArray> CharacterAbilities; + + UPROPERTY(BlueprintReadOnly, EditAnywhere, category = "Abilities") + TSubclassOf DefaultAttributes; + UPROPERTY(BlueprintReadOnly, EditAnywhere, category = "Abilities") + TArray> StartupEffects; + + virtual void AddCharacterAbilities(); + virtual void InitializeAttributes(); + virtual void AddStartupEffects(); + + void InitializeStartingValues(ADefaultPlayerState* State); + + virtual void SetHealth(float Health); + virtual void SetMana(float Mana); + + virtual void OnRep_PlayerState() override; + + bool ASCInputBound = false; + UPROPERTY(EditAnywhere) - USpringArmComponent* CameraSpringArm; + class USpringArmComponent* CameraSpringArm; UPROPERTY(EditAnywhere) - UCameraComponent* Camera; + class UCameraComponent* Camera; }; diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp index a5c9f98..673187f 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp @@ -11,8 +11,12 @@ #include "Navigation/PathFollowingComponent.h" #include "AIController.h" + +#include "../DefaultGameInstance.h" #include "DefaultPlayerState.h" +#include "DefaultPlayerCharacter.h" #include "DefaultPlayerCamera.h" +#include "../Promether.h" @@ -26,13 +30,10 @@ void ADefaultPlayerController::BeginPlay() UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem(); if (!InputSystem) return; - if (PlayerInputMapping.IsNull()) - { - UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed")); - return; - } + UDefaultGameInstance* Instance = GetGameInstance(); + if (!Instance) return; - InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0); + InputSystem->AddMappingContext(Instance->PlayerInputMapping.LoadSynchronous(), 0); this->bShowMouseCursor = true; } @@ -42,7 +43,10 @@ void ADefaultPlayerController::OnPossess(APawn* aPawn) Server_SpawnPlayerCamera(); - AActor *PlayerCamera = GetPlayerState()->GetPlayerCamera(); + ADefaultPlayerState* State = GetPlayerState(); + if (!State) return; + + AActor *PlayerCamera = State->GetPlayerCamera(); if (!PlayerCamera) { UE_LOG(LogTemp, Error, TEXT("GetPlayerCamera Failed.")); @@ -51,7 +55,12 @@ void ADefaultPlayerController::OnPossess(APawn* aPawn) SetViewTarget(PlayerCamera); - UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState()->GetPlayerCamera()->GetName()); + UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *State->GetPlayerCamera()->GetName()); + + State->GetAbilitySystemComponent()->InitAbilityActorInfo(State, aPawn); + /* + * + * This was Stat initialize code. Depricated. ADefaultPlayerCharacter* ControlledPawn = GetPawn(); if (!ControlledPawn) return; @@ -66,6 +75,7 @@ void ADefaultPlayerController::OnPossess(APawn* aPawn) ControlledPawn->CooldownDuration.GenerateValueArray(CooldownDurationValue); MyPlayerState->InitPlayerStats(DefaultStatsValue, CooldownDurationValue); + */ } void ADefaultPlayerController::OnUnPossess() @@ -134,96 +144,11 @@ ADefaultPlayerController::ADefaultPlayerController() AutoManageActiveCameraTarget(false); DefaultMouseCursor = EMouseCursor::Crosshairs; - - static ConstructorHelpers::FObjectFinder - DEFAULT_CONTEXT(TEXT("/Script/EnhancedInput.InputMappingContext'/Game/InputActions/InputMappingContext.InputMappingContext'")); - if (!DEFAULT_CONTEXT.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("DEFAULT_CONTEXT load failed.")); - return; - } - - static ConstructorHelpers::FObjectFinder - IA_SKILL1(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Skill1.Skill1'")), - IA_SKILL2(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Skill2.Skill2'")), - IA_SKILL3(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Skill3.Skill3'")), - IA_SKILL4(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Skill4.Skill4'")), - IA_RUNESPELL1(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/RuneSpell1.RuneSpell1'")), - IA_RUNESPELL2(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/RuneSpell2.RuneSpell2'")), - IA_WARD(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Ward.Ward'")), - IA_BOMB(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Bomb.Bomb'")), - IA_OBJECTSELECT(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/ObjectSelect.ObjectSelect'")), - IA_MOVE(TEXT("/Script/EnhancedInput.InputAction'/Game/InputActions/Move.Move'")); - - if (!IA_SKILL1.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_SKILL1 load failed.")); - return; - } - if (!IA_SKILL2.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_SKILL2 load failed.")); - return; - } - if (!IA_SKILL3.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_SKILL3 load failed.")); - return; - } - if (!IA_SKILL4.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_ULTIMATESKILL load failed.")); - return; - } - if (!IA_RUNESPELL1.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_RUNESPELL1 load failed.")); - return; - } - if (!IA_RUNESPELL2.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_RUNESPELL2 load failed.")); - return; - } - if (!IA_WARD.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_WARD load failed.")); - return; - } - if (!IA_BOMB.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_BOMB load failed.")); - return; - } - if (!IA_OBJECTSELECT.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_OBJECTSELECT load failed.")); - return; - } - if (!IA_MOVE.Succeeded()) - { - UE_LOG(LogTemp, Error, TEXT("IA_MOVE load failed.")); - return; - } - - PlayerInputMapping = DEFAULT_CONTEXT.Object; - Skill1Action = IA_SKILL1.Object; - Skill2Action = IA_SKILL2.Object; - Skill3Action = IA_SKILL3.Object; - Skill4Action = IA_SKILL4.Object; - RuneSpell1Action = IA_RUNESPELL1.Object; - RuneSpell2Action = IA_RUNESPELL2.Object; - WardAction = IA_WARD.Object; - BombAction = IA_BOMB.Object; - ObjectSelectAction = IA_OBJECTSELECT.Object; - MoveAction = IA_MOVE.Object; } void ADefaultPlayerController::Tick(float DeltaTime) { Super::Tick(DeltaTime); - - } void ADefaultPlayerController::SetupInputComponent() @@ -233,174 +158,35 @@ void ADefaultPlayerController::SetupInputComponent() UEnhancedInputComponent* EnhancedInputComponent = Cast(InputComponent); if (!EnhancedInputComponent) return; - EnhancedInputComponent->BindAction(Skill1Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill1); - EnhancedInputComponent->BindAction(Skill2Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill2); - EnhancedInputComponent->BindAction(Skill3Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill3); - EnhancedInputComponent->BindAction(Skill4Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Skill4Triggered); - EnhancedInputComponent->BindAction(Skill4Action.Get(), ETriggerEvent::Completed, this, &ADefaultPlayerController::Skill4Completed); - EnhancedInputComponent->BindAction(RuneSpell1Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::RuneSpell1); - EnhancedInputComponent->BindAction(RuneSpell2Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::RuneSpell2); - EnhancedInputComponent->BindAction(WardAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Ward); - EnhancedInputComponent->BindAction(BombAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Bomb); - EnhancedInputComponent->BindAction(ObjectSelectAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::ObjectSelect); - EnhancedInputComponent->BindAction(MoveAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Move); -} - -void ADefaultPlayerController::Skill1() -{ - if (!GetPlayerState()->Stats[(uint8)EStats::Skillusable] == 0) - return; - if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill1Cost])) - return; - GetPlayerState()->Stats[(uint8)EStats::Mana] -= GetPlayerState()->Stats[(uint8)EStats::Skill1Cost]; - EndAttack(); - - GetPlayerState()->Stats[(uint8)EStats::Attackable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Skillusable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Movable] = 1; - - - ACharacter* HitObject = nullptr; - FVector Location = GetPawn()->GetActorLocation(); - Location.Z = 0; - - Server_StopMove(); - Multicast_StopMove(); - - Multicast_SetRotation(GetMouseHitLocation()); - Server_SetRotation(GetMouseHitLocation()); - - UE_LOG(LogTemp, Warning, TEXT("Skill1")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill1); -} - -void ADefaultPlayerController::Skill2() -{ - if (!GetPlayerState()->Stats[(uint8)EStats::Skillusable] == 0) - return; - if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill2Cost])) - return; - GetPlayerState()->Stats[(uint8)EStats::Mana] -= GetPlayerState()->Stats[(uint8)EStats::Skill2Cost]; - - EndAttack(); - GetPlayerState()->Stats[(uint8)EStats::Attackable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Skillusable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Movable] = 1; - ACharacter* HitObject = nullptr; - FVector Location = GetPawn()->GetActorLocation(); - Location.Z = 0; - - Server_StopMove(); - Multicast_StopMove(); - - Multicast_SetRotation(GetMouseHitLocation()); - Server_SetRotation(GetMouseHitLocation()); - - UE_LOG(LogTemp, Warning, TEXT("Skill2")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill2); -} - -void ADefaultPlayerController::Skill3() -{ - if (!GetPlayerState()->Stats[(uint8)EStats::Skillusable] == 0) - return; - if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill3Cost])) - return; - GetPlayerState()->Stats[(uint8)EStats::Mana] -= GetPlayerState()->Stats[(uint8)EStats::Skill3Cost]; - EndAttack(); - GetPlayerState()->Stats[(uint8)EStats::Attackable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Skillusable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Movable] = 1; - - ACharacter* HitObject = nullptr; - FVector Location = GetPawn()->GetActorLocation(); - Location.Z = 0; - - Server_StopMove(); - Multicast_StopMove(); - - Multicast_SetRotation(GetMouseHitLocation()); - Server_SetRotation(GetMouseHitLocation()); - - UE_LOG(LogTemp, Warning, TEXT("Skill3")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill3); -} - -void ADefaultPlayerController::Skill4Triggered() -{ - if (GetPlayerState()->Stats[(uint8)EStats::charging] == 1)//Â÷Áö°¡ 1(false)ÀÏ ¶§ - { - if (!GetPlayerState()->Stats[(uint8)EStats::Skillusable] == 0) - return; - if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill4Cost])) - return; - GetPlayerState()->Stats[(uint8)EStats::Mana] -= GetPlayerState()->Stats[(uint8)EStats::Skill4Cost]; - GetPlayerState()->Stats[(uint8)EStats::charging] = 0;// ¼öÄ¡¸¦ °è»êÇϰí charge¸¦ true(0)·Î º¯°æ - } - else if (GetPlayerState()->Stats[(uint8)EStats::charging] == 2) //Â÷Áö°¡ 2(never)ÀÏ ¶§ - { - if (!GetPlayerState()->Stats[(uint8)EStats::Skillusable] == 0) - return; - if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill4Cost])) - return; - GetPlayerState()->Stats[(uint8)EStats::Mana] -= GetPlayerState()->Stats[(uint8)EStats::Skill4Cost]; // ±×³É ¼öÄ¡ °è»ê¸¸ ½ÇÇà - } - EndAttack(); - GetPlayerState()->Stats[(uint8)EStats::Attackable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Skillusable] = 1; - GetPlayerState()->Stats[(uint8)EStats::Movable] = 1; - - ACharacter* HitObject = nullptr; - FVector Location = GetPawn()->GetActorLocation(); - Location.Z = 0; - - Server_StopMove(); - Multicast_StopMove(); - - Multicast_SetRotation(GetMouseHitLocation()); - Server_SetRotation(GetMouseHitLocation()); - - UE_LOG(LogTemp, Warning, TEXT("Skill4 Triggered")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill4Triggered); -} - -void ADefaultPlayerController::Skill4Completed() -{ - UE_LOG(LogTemp, Warning, TEXT("Skill4 Completed")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill4Comlpleted); + UDefaultGameInstance* Instance = GetGameInstance(); + if (!Instance) return; + + EnhancedInputComponent->BindAction(Instance->RuneSpell1Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::RuneSpell1); + EnhancedInputComponent->BindAction(Instance->RuneSpell2Action.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::RuneSpell2); + EnhancedInputComponent->BindAction(Instance->WardAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Ward); + EnhancedInputComponent->BindAction(Instance->BombAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Bomb); + EnhancedInputComponent->BindAction(Instance->ObjectSelectAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::ObjectSelect); + EnhancedInputComponent->BindAction(Instance->MoveAction.Get(), ETriggerEvent::Triggered, this, &ADefaultPlayerController::Move); } void ADefaultPlayerController::RuneSpell1() { UE_LOG(LogTemp, Warning, TEXT("RuneSpell1")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::RuneSpell1); } void ADefaultPlayerController::RuneSpell2() { UE_LOG(LogTemp, Warning, TEXT("RuneSpell2")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::RuneSpell2); } void ADefaultPlayerController::Ward() { UE_LOG(LogTemp, Warning, TEXT("Ward")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Ward); } void ADefaultPlayerController::Bomb() { UE_LOG(LogTemp, Warning, TEXT("Bomb")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Bomb); } void ADefaultPlayerController::ObjectSelect() @@ -448,15 +234,18 @@ void ADefaultPlayerController::Move() if (GetPlayerState()->GetCurrentAttackTarget() != GetPawn() && Cast(GetPlayerState()->GetCurrentAttackTarget())) //º»ÀÎÀÌ ¾Æ´Ï°í °ø°ÝÀÌ °¡´ÉÇÑ ´ë»ó(ÀûÀÌµç ¾Æ±ºÀ̵ç)ÀÏ ¶§ { - if (!GetPlayerState()->Stats[(uint8)EStats::Attackable] == 0) return; + //if (!GetPlayerState()->Stats[(uint8)EStats::Attackable] == 0) return; BeginAttack(); //HitObject¸¦ ´ë»óÀ¸·Î BeginAttack ½ÇÇà } else { - if (!GetPlayerState()->Stats[(uint8)EStats::Movable] == 0) - return; + //if (!GetPlayerState()->Stats[(uint8)EStats::Movable] == 0) + // return; FVector Destination = GetMouseHitLocation(); + // TODO - animation state update fix + /* GetPlayerState()->SetState(ECharacterState::Moving); + */ SimpleMoveToLocation(this, Destination); this->MoveToLocation(Destination); } @@ -632,7 +421,10 @@ void ADefaultPlayerController::OnMoveCompleted(FAIRequestID RequestID, const FPa UE_LOG(LogTemp, Warning, TEXT("Client%d MoveCompleted"), GPlayInEditorID); } + // TODO - animation state update fix + /* GetPlayerState()->SetState(ECharacterState::Idle); + */ } void ADefaultPlayerController::BeginAttack() @@ -652,19 +444,19 @@ void ADefaultPlayerController::RepeatedAttack() void ADefaultPlayerController::Attack() { - if (!GetPlayerState()->Stats[(uint8)EStats::Attackable] == 0) - return; + //if (!GetPlayerState()->Stats[(uint8)EStats::Attackable] == 0) + // return; - float MinDistance = GetPlayerState()->Stats[(uint8)EStats:: AttackRange]; + //float MinDistance = GetPlayerState()->Stats[(uint8)EStats:: AttackRange]; if (!GetPlayerState()->GetCurrentAttackTarget()) return; FVector Destination = GetPlayerState()->GetCurrentAttackTarget()->GetActorLocation(); // HitObjectÀÇ À§Ä¡¸¦ ¸ñÀûÁö·Î ¼³Á¤ - if (FVector::Dist(Destination, GetPawn()->GetActorLocation()) <= MinDistance) + if (/*FVector::Dist(Destination, GetPawn()->GetActorLocation()) <= MinDistance*/ true) { - if ((GetPlayerState()->CooldownDuration[(uint8)CooldownType::Attack] != 0)) - return; + //if ((GetPlayerState()->CooldownDuration[(uint8)CooldownType::Attack] != 0)) + // return; FVector Location = GetPawn()->GetActorLocation(); Location.X = 0; @@ -675,13 +467,19 @@ void ADefaultPlayerController::Attack() Multicast_SetRotation(Destination); Server_SetRotation(Destination); + // TODO - animation state update fix + /* UE_LOG(LogTemp, Warning, TEXT("Attack")); GetPlayerState()->SetState(ECharacterState::Attack); GetPlayerState()->SetAttackType(CooldownType::Attack); + */ } else { + // TODO - animation state update fix + /* GetPlayerState()->SetState(ECharacterState::Moving); + */ SimpleMoveToLocation(this, Destination); this->MoveToLocation(Destination); } diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerController.h b/Source/Promether/PlayerGeneric/DefaultPlayerController.h index 711ffdd..b62f3c9 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerController.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerController.h @@ -30,12 +30,7 @@ public: virtual void Tick(float DeltaTime) override; virtual void SetupInputComponent() override; - - void Skill1(); - void Skill2(); - void Skill3(); - void Skill4Triggered(); - void Skill4Completed(); + void RuneSpell1(); void RuneSpell2(); void Ward(); @@ -78,29 +73,4 @@ public: float MouseClickInterval; FTimerHandle TimerHandle; - -private: - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr PlayerInputMapping; - - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr Skill1Action; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr Skill2Action; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr Skill3Action; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr Skill4Action; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr RuneSpell1Action; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr RuneSpell2Action; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr WardAction; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr BombAction; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr ObjectSelectAction; - UPROPERTY(EditAnywhere, Category = "Input") - TSoftObjectPtr MoveAction; }; diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp index 13cdf64..51e1b40 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp @@ -6,8 +6,6 @@ ADefaultPlayerState::ADefaultPlayerState() { CharacterBPRef = nullptr; - Team = TeamType::Null; - State = ECharacterState::Idle; AbilitySystemComponent = CreateDefaultSubobject(TEXT("AbilitySystemComponent")); AbilitySystemComponent->SetIsReplicated(true); @@ -18,7 +16,8 @@ ADefaultPlayerState::ADefaultPlayerState() NetUpdateFrequency = 100.0f; DeadTag = FGameplayTag::RequestGameplayTag(FName("State.Dead")); - EffectTag = FGameplayTag::RequestGameplayTag(FName("State.EffectTag")); + TeamTag = FGameplayTag::RequestGameplayTag(FName("Team.Neutral"));; + EffectTag = FGameplayTag::RequestGameplayTag(FName("State.Return")); } void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const @@ -26,17 +25,7 @@ void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray& Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME(ADefaultPlayerState, CharacterBPRef); - DOREPLIFETIME(ADefaultPlayerState, Team); - - DOREPLIFETIME(ADefaultPlayerState, CooldownDuration); - - DOREPLIFETIME(ADefaultPlayerState, Stats); - DOREPLIFETIME(ADefaultPlayerState, MaxStats); - - DOREPLIFETIME(ADefaultPlayerState, State); - DOREPLIFETIME(ADefaultPlayerState, AttackType); DOREPLIFETIME(ADefaultPlayerState, PlayerCamera); - DOREPLIFETIME(ADefaultPlayerState, CurrentAttackTarget); DOREPLIFETIME(ADefaultPlayerState, PreviousAttackTarget); } @@ -46,6 +35,31 @@ UAbilitySystemComponent* ADefaultPlayerState::GetAbilitySystemComponent() const return AbilitySystemComponent; } +UCharacterBaseAttribute* ADefaultPlayerState::GetAttributeSet() const +{ + return Attribute; +} + +bool ADefaultPlayerState::IsDead() const +{ + return GetHealth() < 0.0f; +} + +void ADefaultPlayerState::ShowAbliityConfirmCancelText(bool ShowText) +{ + // TODO -- implement HUD +} + +TeamType ADefaultPlayerState::GetTeam() const +{ + return TeamType::Null; +} + +float ADefaultPlayerState::GetXP() const +{ + return Attribute->GetXP(); +} + float ADefaultPlayerState::GetHealth() const { return Attribute->GetHealth(); @@ -66,42 +80,58 @@ float ADefaultPlayerState::GetMaxMana() const return Attribute->GetMaxMana(); } -void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray& StatsValue, const TArray& CooldownDurationValue) +int32 ADefaultPlayerState::GetCharacterLevel() const { - MaxStats.Append(StatsValue); - Stats.Append(StatsValue); - CooldownDuration.Append(CooldownDurationValue); - MaxCooldownDuration.Append(CooldownDurationValue); + return Attribute->GetXP() / 100.0f; +} - for (float Value : StatsValue) +void ADefaultPlayerState::BeginPlay() +{ + Super::BeginPlay(); + + if (AbilitySystemComponent) { - UE_LOG(LogTemp, Warning, TEXT("Values: %f"), Value); + TeamChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetHealthAttribute()).AddUObject(this, &ADefaultPlayerState::TeamChanged); + XPChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetHealthAttribute()).AddUObject(this, &ADefaultPlayerState::XPChanged); + HealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetHealthAttribute()).AddUObject(this, &ADefaultPlayerState::HealthChanged); + MaxHealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetMaxHealthAttribute()).AddUObject(this, &ADefaultPlayerState::MaxHealthChanged); + ManaChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetManaAttribute()).AddUObject(this, &ADefaultPlayerState::ManaChanged); + MaxManaChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetMaxManaAttribute()).AddUObject(this, &ADefaultPlayerState::MaxManaChanged); + + AbilitySystemComponent->RegisterGameplayTagEvent( + FGameplayTag::RequestGameplayTag(FName("State.Debuff.Stun")), EGameplayTagEventType::NewOrRemoved + ).AddUObject(this, &ADefaultPlayerState::StunTagChanged); } } -void ADefaultPlayerState::NetMulticast_SetAttackType_Implementation(CooldownType Value) +void ADefaultPlayerState::TeamChanged(const FOnAttributeChangeData& Data) { - AttackType = Value; + UE_LOG(LogTemp, Warning, TEXT("TeamChanged")); } -void ADefaultPlayerState::NetMulticast_SetState_Implementation(ECharacterState Value) +void ADefaultPlayerState::XPChanged(const FOnAttributeChangeData& Data) { - State = Value; + UE_LOG(LogTemp, Warning, TEXT("XPChanged")); } -void ADefaultPlayerState::SetState_Implementation(ECharacterState Value) +void ADefaultPlayerState::HealthChanged(const FOnAttributeChangeData& Data) { - NetMulticast_SetState(Value); + UE_LOG(LogTemp, Warning, TEXT("HealthChanged")); } -void ADefaultPlayerState::SetAttackType_Implementation(CooldownType Value) +void ADefaultPlayerState::MaxHealthChanged(const FOnAttributeChangeData& Data) { - NetMulticast_SetAttackType(Value); + UE_LOG(LogTemp, Warning, TEXT("MaxHealthChanged")); } -int32 ADefaultPlayerState::GetCharacterLevel() const +void ADefaultPlayerState::ManaChanged(const FOnAttributeChangeData& Data) { - return int32(); + UE_LOG(LogTemp, Warning, TEXT("ManaChanged")); +} + +void ADefaultPlayerState::MaxManaChanged(const FOnAttributeChangeData& Data) +{ + UE_LOG(LogTemp, Warning, TEXT("MaxManaChanged")); } void ADefaultPlayerState::SetCurrentAttackTarget(AActor* Target) @@ -110,6 +140,12 @@ void ADefaultPlayerState::SetCurrentAttackTarget(AActor* Target) Client_SetCurrentAttackTarget(Target); } +void ADefaultPlayerState::SetPreviousAttackTarget(AActor* Target) +{ + Server_SetPreviousAttackTarget(Target); + Client_SetPreviousAttackTarget(Target); +} + void ADefaultPlayerState::Server_SetCurrentAttackTarget_Implementation(AActor* Target) { CurrentAttackTarget = Target; @@ -120,43 +156,6 @@ void ADefaultPlayerState::Client_SetCurrentAttackTarget_Implementation(AActor* T CurrentAttackTarget = Target; } -void ADefaultPlayerState::SetPreviousAttackTarget(AActor* Target) -{ - Server_SetPreviousAttackTarget(Target); - Client_SetPreviousAttackTarget(Target); -} - -void ADefaultPlayerState::BeginPlay() -{ - Super::BeginPlay(); - - if (AbilitySystemComponent) - { - HealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetHealthAttribute()).AddUObject(this, &ADefaultPlayerState::HealthChanged); - MaxHealthChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetMaxHealthAttribute()).AddUObject(this, &ADefaultPlayerState::MaxHealthChanged); - ManaChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetManaAttribute()).AddUObject(this, &ADefaultPlayerState::ManaChanged); - MaxManaChangedDelegateHandle = AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Attribute->GetMaxManaAttribute()).AddUObject(this, &ADefaultPlayerState::MaxManaChanged); - - //AbilitySystemComponent->RegisterGameplayTagEvent(FGameplayTag::Request) - } -} - -void ADefaultPlayerState::HealthChanged(const FOnAttributeChangeData& Data) -{ -} - -void ADefaultPlayerState::MaxHealthChanged(const FOnAttributeChangeData& Data) -{ -} - -void ADefaultPlayerState::ManaChanged(const FOnAttributeChangeData& Data) -{ -} - -void ADefaultPlayerState::MaxManaChanged(const FOnAttributeChangeData& Data) -{ -} - void ADefaultPlayerState::Server_SetPreviousAttackTarget_Implementation(AActor* Target) { PreviousAttackTarget = Target; @@ -166,3 +165,17 @@ void ADefaultPlayerState::Client_SetPreviousAttackTarget_Implementation(AActor* { PreviousAttackTarget = Target; } + +void ADefaultPlayerState::StunTagChanged(const FGameplayTag CallbackTag, int32 NewCount) +{ + if (NewCount > 0) + { + FGameplayTagContainer AbilityTagsToCancel; + AbilityTagsToCancel.AddTag(FGameplayTag::RequestGameplayTag(FName("Ability"))); + + FGameplayTagContainer AbilityTagsToIgnore; + AbilityTagsToCancel.AddTag(FGameplayTag::RequestGameplayTag(FName("Ability.NotCanceledByStun"))); + + AbilitySystemComponent->CancelAbilities(&AbilityTagsToCancel, &AbilityTagsToIgnore); + } +} diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerState.h b/Source/Promether/PlayerGeneric/DefaultPlayerState.h index a7cf137..3deaabe 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerState.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerState.h @@ -11,7 +11,7 @@ #include #include "../PrometherEnum.h" -#include "DefaultPlayerCharacter.h" +#include "../GAS/AttributeSet/CharacterBaseAttribute.h" #include "DefaultPlayerState.generated.h" UCLASS() @@ -23,58 +23,35 @@ public: ADefaultPlayerState(); void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override; - virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override; - - UFUNCTION(Server, Reliable) - void InitPlayerStats(const TArray& StatsValue, const TArray& CooldownDurationValue); + virtual class UAbilitySystemComponent* GetAbilitySystemComponent() const override; void SetCharacterBPRef(UClass* Value) { CharacterBPRef = Value; } UClass* GetCharacterBPRef() const { return CharacterBPRef; } - UFUNCTION(BlueprintCallable, Category = "Attributes") + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState") + TeamType GetTeam() const; + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState|Attributes") + float GetXP() const; + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState|Attributes") float GetHealth() const; - UFUNCTION(BlueprintCallable, Category = "Attributes") + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState|Attributes") float GetMaxHealth() const; - UFUNCTION(BlueprintCallable, Category = "Attributes") + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState|Attributes") float GetMana() const; - UFUNCTION(BlueprintCallable, Category = "Attributes") + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState|Attributes") float GetMaxMana() const; class UCharacterBaseAttribute* GetAttributeSet() const; - //UFUNCTION(BlueprintCallable) - //bool IsDead() const; + UFUNCTION(BlueprintCallable) + bool IsDead() const; - UFUNCTION(BlueprintCallable) - void SetTeam(TeamType Value) { Team = Value; } - UFUNCTION(BlueprintCallable) - TeamType GetTeam() const { return Team; } + UFUNCTION(BlueprintCallable, Category = "DefaultPlayerState|UI") + void ShowAbliityConfirmCancelText(bool ShowText); void SetPlayerCamera(AActor* Actor) { PlayerCamera = Actor; } AActor* GetPlayerCamera() const { return PlayerCamera; } - //fix later - //UFUNCTION(BlueprintCallable) - //void SetCooldownDuration(CooldownType Key, float Value) { CooldownDuration[(uint8)Key] = Value; } - //UFUNCTION(BlueprintCallable) - //float GetCooldownDuration(CooldownType Key) const { return CooldownDuration[(uint8)Key]; } - - //Execute on server - UFUNCTION(BlueprintCallable, Server, Reliable) - void SetState(ECharacterState Value); - UFUNCTION(BlueprintCallable, NetMulticast, Reliable) - void NetMulticast_SetState(ECharacterState Value); - UFUNCTION(BlueprintCallable) - ECharacterState GetState() const { return State; } - - //Execute on server - UFUNCTION(BlueprintCallable, Server, Reliable) - void SetAttackType(CooldownType Value); - UFUNCTION(BlueprintCallable, NetMulticast, Reliable) - void NetMulticast_SetAttackType(CooldownType Value); - UFUNCTION(BlueprintCallable) - CooldownType GetAttackType() const { return AttackType; } - UFUNCTION(BlueprintCallable) int32 GetCharacterLevel() const; @@ -110,8 +87,11 @@ protected: class UCharacterBaseAttribute* Attribute; FGameplayTag DeadTag; + FGameplayTag TeamTag; FGameplayTag EffectTag; + FDelegateHandle TeamChangedDelegateHandle; + FDelegateHandle XPChangedDelegateHandle; FDelegateHandle HealthChangedDelegateHandle; FDelegateHandle MaxHealthChangedDelegateHandle; FDelegateHandle ManaChangedDelegateHandle; @@ -119,24 +99,21 @@ protected: virtual void BeginPlay() override; + virtual void TeamChanged(const FOnAttributeChangeData& Data); + virtual void XPChanged(const FOnAttributeChangeData& Data); virtual void HealthChanged(const FOnAttributeChangeData& Data); virtual void MaxHealthChanged(const FOnAttributeChangeData& Data); virtual void ManaChanged(const FOnAttributeChangeData& Data); virtual void MaxManaChanged(const FOnAttributeChangeData& Data); + virtual void StunTagChanged(const FGameplayTag CallbackTag, int32 NewCount); + UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Abilities") TSubclassOf DefaultAttributes; private: UPROPERTY(Replicated, Transient) - UClass* CharacterBPRef; - UPROPERTY(Replicated, Transient) - TeamType Team; - - UPROPERTY(Replicated, Transient) - ECharacterState State; - UPROPERTY(Replicated, Transient) - CooldownType AttackType; + UClass* CharacterBPRef; UPROPERTY(Replicated, Transient) AActor* PlayerCamera; diff --git a/Source/Promether/Promether.h b/Source/Promether/Promether.h index 0284f0f..dcbcf40 100644 --- a/Source/Promether/Promether.h +++ b/Source/Promether/Promether.h @@ -8,14 +8,12 @@ UENUM(BlueprintType) enum class EDefaultAbilityID : uint8 { None UMETA(DisplayName = "None"), + Confirm UMETA(DisplayName = "Confirm"), + Cancel UMETA(DisplayName = "Cancel"), BaseAttack UMETA(DisplayName = "BaseAttack"), Skill1 UMETA(DisplayName = "Skill1"), Skill2 UMETA(DisplayName = "Skill2"), Skill3 UMETA(DisplayName = "Skill3"), Skill4 UMETA(DisplayName = "Skill4"), - RuneSpell1 UMETA(DisplayName = "RuneSpell1"), - RuneSpell2 UMETA(DisplayName = "RuneSpell2"), - Ward UMETA(DisplayName = "Ward"), - Bomb UMETA(DisplayName = "Bomb"), SIZE }; \ No newline at end of file