diff --git a/Content/Character/Allium/BP_Allium.uasset b/Content/Character/Allium/BP_Allium.uasset index 8af03e5..9122094 100644 --- a/Content/Character/Allium/BP_Allium.uasset +++ b/Content/Character/Allium/BP_Allium.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fcb784f0cb24a64149aec72d17cb4247ead004a0b33e9a3b4e35b5df4979ad06 -size 136354 +oid sha256:f2170a5f1bef59fe201c622cace975291f9352897ca17b186c05cacd41e8709a +size 130328 diff --git a/Content/Character/BP_Folder/BP_DefaultPlayerCharacter.uasset b/Content/Character/BP_Folder/BP_DefaultPlayerCharacter.uasset new file mode 100644 index 0000000..67fc4cc --- /dev/null +++ b/Content/Character/BP_Folder/BP_DefaultPlayerCharacter.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:593ac8b14902ff3cf56e93f7dfb7415ab8cf10bd717378d6a04eff2beb3921d0 +size 106010 diff --git a/Content/Character/BP_Folder/DefaultClass.uasset b/Content/Character/BP_Folder/DefaultClass.uasset index 290e04d..53535d1 100644 --- a/Content/Character/BP_Folder/DefaultClass.uasset +++ b/Content/Character/BP_Folder/DefaultClass.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b5ed77da0ce480dc769b0b85a288efb92533d78c89c87e099f1113df2782f898 -size 18108 +oid sha256:25cdab2bc7f4974adf1757b7cb5f49a1992c2138539efa84aa91d1ed1e1f402d +size 12818 diff --git a/Content/Character/Lb/Animation/ABP_Lb.uasset b/Content/Character/Lb/Animation/ABP_Lb.uasset index 8700d33..5a81b45 100644 --- a/Content/Character/Lb/Animation/ABP_Lb.uasset +++ b/Content/Character/Lb/Animation/ABP_Lb.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9106395cf5962f94dbfd58c77289cabe04829abd6c6d4e94fd1dc650d77deb29 -size 275233 +oid sha256:55f905bcd305f8c23ee484fa11fcae581e830cb01132382ee18d7aba8035c2b0 +size 337395 diff --git a/Content/Character/Lb/Animation/R1_Anim.uasset b/Content/Character/Lb/Animation/R1_Anim.uasset index 4a5eb40..e7f7184 100644 --- a/Content/Character/Lb/Animation/R1_Anim.uasset +++ b/Content/Character/Lb/Animation/R1_Anim.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e482c12f9233091ad310daf9432f4773dba20592e67dbb77eb4a93f22bf954a -size 77110 +oid sha256:d71615249a5ae4fa14c8db5e3b419f47f3577ffa83d7d8ac77daacae7c399fcb +size 77129 diff --git a/Content/Character/Lb/Animation/R2_Anim.uasset b/Content/Character/Lb/Animation/R2_Anim.uasset index b86911a..8a69d0e 100644 --- a/Content/Character/Lb/Animation/R2_Anim.uasset +++ b/Content/Character/Lb/Animation/R2_Anim.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c5d110cbc5ae8d4b489b73f7a2b7b955803f0ebc65b45c53054e3777484f8b8 -size 164688 +oid sha256:228c3f0cc7442f470f1f6ecd7ac3e46d058570c339c3ea599db5a9e6e27da282 +size 164747 diff --git a/Content/Character/Lb/Animation/Treasure_Attack1_Anim.uasset b/Content/Character/Lb/Animation/Treasure_Attack1_Anim.uasset index 5499d72..f757a61 100644 --- a/Content/Character/Lb/Animation/Treasure_Attack1_Anim.uasset +++ b/Content/Character/Lb/Animation/Treasure_Attack1_Anim.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2470baf2b6f18679fe64504da91f899cb59e252f14a1bee3fd81d96928c960a6 -size 140654 +oid sha256:a91864ef5ec5faced4df2eb509c700788d5893295d91f60e27cf67eeb7d09fe0 +size 144533 diff --git a/Content/Character/Lb/BP_Lb.uasset b/Content/Character/Lb/BP_Lb.uasset index ed5ae7a..9f47318 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:5823f96c3536dcb4e632cd19dfc682a50b9b02d64e73e61f1fecbc0b09e4b4da -size 147586 +oid sha256:5c39784d45dfac8cce880c52bff49faa73e19f7cbd349d6cb9aa0e22c5bd34f6 +size 233790 diff --git a/Content/Character/Lb/EskillBuff.uasset b/Content/Character/Lb/EskillBuff.uasset new file mode 100644 index 0000000..31e306e --- /dev/null +++ b/Content/Character/Lb/EskillBuff.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9628fbbcc216c910586edbfe2ebb76fc2a99e98ea91c55602d72811081609fd6 +size 100232 diff --git a/Content/Character/Lb/LB_Bolla_Throw.uasset b/Content/Character/Lb/LB_Bolla_Throw.uasset index 8328842..ea761fe 100644 --- a/Content/Character/Lb/LB_Bolla_Throw.uasset +++ b/Content/Character/Lb/LB_Bolla_Throw.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fb47290031b302262dc6571fe6ff9eaf99f70ad2af232f572e3f711235e94727 -size 31160 +oid sha256:ac51d277a931a1f4d37e796a821e86e3d5fc0f31f4f1b6e4a08b84afe3989a50 +size 55765 diff --git a/Content/Character/Riana/Animation/ABP_Riana.uasset b/Content/Character/Riana/Animation/ABP_Riana.uasset new file mode 100644 index 0000000..31d9165 --- /dev/null +++ b/Content/Character/Riana/Animation/ABP_Riana.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6ab8c7cedf9b7edff8ac5d728af9495548063b01a935d42c7ac28f59150f09f +size 328801 diff --git a/Content/Character/Riana/Animation/Skill3_Anim.uasset b/Content/Character/Riana/Animation/Skill3_Anim.uasset index 2971305..ef75984 100644 --- a/Content/Character/Riana/Animation/Skill3_Anim.uasset +++ b/Content/Character/Riana/Animation/Skill3_Anim.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:98351f36274d3fa4d24a4b412190e29f1ed1bdb0f65a0b19c31e752043439aad -size 232728 +oid sha256:d207c80c476fac57686c95dbae7c5ec77bf3d53fe6150ed19246eea65f471ca4 +size 235183 diff --git a/Content/Character/Riana/Animation/Skill4_3_Anim.uasset b/Content/Character/Riana/Animation/Skill4_3_Anim.uasset index 2047ae6..86d2780 100644 --- a/Content/Character/Riana/Animation/Skill4_3_Anim.uasset +++ b/Content/Character/Riana/Animation/Skill4_3_Anim.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43c9f5f1437c71a029ee74ea05f46948c12c704f778d1e2f0c4dfe3c13e0dbba -size 300215 +oid sha256:e208e84d3ac53af1e7e784b215e83e8f94c49fa56ec0c9a2c6bbd213d1142300 +size 302627 diff --git a/Content/Character/Riana/BP_Riana.uasset b/Content/Character/Riana/BP_Riana.uasset index 2365802..2e8aa4b 100644 --- a/Content/Character/Riana/BP_Riana.uasset +++ b/Content/Character/Riana/BP_Riana.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bde9cd65e2ab75ed06ae9db07a01ef03cd1ed94e8a9bdbf6402e1e850a20e556 -size 34359 +oid sha256:c21e9b8605595d4c8b890bb9a254fdb13a0571e726e14bbc16afdaf8cf7dee9b +size 34177 diff --git a/Content/Effect/ETC/Burning.uasset b/Content/Effect/ETC/Burning.uasset index 122040d..2f9ce9b 100644 --- a/Content/Effect/ETC/Burning.uasset +++ b/Content/Effect/ETC/Burning.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aae95b8020e46c60b8691e209c9ab55bf9caab64ba46da28e1b6c75476903b1f -size 852156 +oid sha256:17b145213e627593f25ecac880ab195efe963c75e42d22ac120d4bee1545e420 +size 603080 diff --git a/Content/Effect/LB/Arrow/Arrow_Flash.uasset b/Content/Effect/LB/Arrow/Arrow_Flash.uasset index 3bc7ca9..6fc4b39 100644 --- a/Content/Effect/LB/Arrow/Arrow_Flash.uasset +++ b/Content/Effect/LB/Arrow/Arrow_Flash.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:073ecf1386b299aba1eea78a1405a835471356d9a0bb4106425c140e4dba7319 -size 893601 +oid sha256:7036040b1e2cba274c767596dc14415dd1a2c06a807a85081475c8b14935617b +size 892797 diff --git a/Content/Effect/LB/LB_Sprint.uasset b/Content/Effect/LB/LB_Sprint.uasset index 5247f7e..8a690d2 100644 --- a/Content/Effect/LB/LB_Sprint.uasset +++ b/Content/Effect/LB/LB_Sprint.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a03fac58192b79035bf6dc47c592021b9fa68891259c05f342c7f076b6471555 -size 3192528 +oid sha256:63b2b3c0efc3d57966767c13b7437660cdd128ae2148fe0fef2e918fadab6abe +size 3347189 diff --git a/Content/InputActions/InputMappingContext.uasset b/Content/InputActions/InputMappingContext.uasset index 8ecb215..0b5099e 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:850f747974f408d1ea8bc0bce5cc3c71a10ea8587d0e14f17afc7da0e3049c7c -size 9369 +oid sha256:211d2c26d7a5c53a14ae7319d4c76917bfbd6f94785c13468fb2e6857a6a1b19 +size 10912 diff --git a/Content/InputActions/ObjectSelect.uasset b/Content/InputActions/ObjectSelect.uasset index 6230f41..bc8e2a1 100644 --- a/Content/InputActions/ObjectSelect.uasset +++ b/Content/InputActions/ObjectSelect.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20963a7668875eb3c81a12a801f23d92900ce274714c38cf692094a1cc97fe27 +oid sha256:b5da50944fc17aa1359bcdfd5e1c254d978392c5b73edcb118e130271b6d484c size 1353 diff --git a/Content/InputActions/Skill4.uasset b/Content/InputActions/Skill4.uasset index 1a57b3b..a177354 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:5b53eb34d07639a7c357d1a9dfbf9ccd5e5a2d1dc47bf60f784f98e0f18e9c46 -size 1323 +oid sha256:0f316965e3f12b135169cd83fd7accf644205ab51b48d81efbc93dd401ebd0bd +size 1392 diff --git a/Content/InputActions/Skill4_End.uasset b/Content/InputActions/Skill4_End.uasset new file mode 100644 index 0000000..6bec5f9 --- /dev/null +++ b/Content/InputActions/Skill4_End.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b7cb2a0d4b9554f2e40b924c03423f726bf79276780a1adb8ca4a38138f1857 +size 1343 diff --git a/Content/Maps/Untitled.umap b/Content/Maps/Untitled.umap deleted file mode 100644 index 7a9aa03..0000000 --- a/Content/Maps/Untitled.umap +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a36218beca4eff11888aaf61c012df87c726ffca88541348f67089f84fc6ce11 -size 178041 diff --git a/Content/StarterContent/Architecture/Floor_400x400.uasset b/Content/StarterContent/Architecture/Floor_400x400.uasset index c2a34af..5b5f5cf 100644 --- a/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 -size 14948 +oid sha256:7bba03e7a10feb5689290b2523db0b25c646e9d01607f07bac3ac8c898d9d3f8 +size 15287 diff --git a/Content/StarterContent/Materials/M_Basic_Floor.uasset b/Content/StarterContent/Materials/M_Basic_Floor.uasset index 07401c9..bbad12e 100644 --- a/Content/StarterContent/Materials/M_Basic_Floor.uasset +++ b/Content/StarterContent/Materials/M_Basic_Floor.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38e9963796183aa39c6cd4219fe60403740c902dadd223b96e37158f5b8e07f8 -size 9515 +oid sha256:5c198493d3a6c0c9dc45fb0e6f964bcb8ec2560507e322ba0fc33ddd7acd4ca4 +size 9609 diff --git a/Content/StarterContent/Particles/Materials/M_Radial_Gradient.uasset b/Content/StarterContent/Particles/Materials/M_Radial_Gradient.uasset index 96f3272..71f3a68 100644 --- a/Content/StarterContent/Particles/Materials/M_Radial_Gradient.uasset +++ b/Content/StarterContent/Particles/Materials/M_Radial_Gradient.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:969f0add70f571adb7e14da5ca542a15955166103efd54168a5e248826564781 -size 10357 +oid sha256:4a2fa64d2953b0d60e01d147b4a139bbf1704b59924ba097a38b735e46a34293 +size 10467 diff --git a/Content/StarterContent/Particles/Materials/M_radial_ramp.uasset b/Content/StarterContent/Particles/Materials/M_radial_ramp.uasset index bc957b9..dbb07b9 100644 --- a/Content/StarterContent/Particles/Materials/M_radial_ramp.uasset +++ b/Content/StarterContent/Particles/Materials/M_radial_ramp.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:880794e3875c4394f93e280b35524a677e72a5a1edb06b03c8a0ae9efc2b51a6 -size 10366 +oid sha256:2ead6fd037a59631d300e27941a8f9a67aae91e306096cded5bd598026c03b7a +size 10471 diff --git a/Content/StarterContent/Particles/Materials/m_flare_01.uasset b/Content/StarterContent/Particles/Materials/m_flare_01.uasset index 4b49de3..6999e57 100644 --- a/Content/StarterContent/Particles/Materials/m_flare_01.uasset +++ b/Content/StarterContent/Particles/Materials/m_flare_01.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57377e5d237609372f0837407d7c9f35a5ba00bf81aa049102d699105af8a025 -size 14010 +oid sha256:4c39c6b073961d3f83eb48231c01a2bc9ca61fca41675eb5ac7ae3eb6ea46cfd +size 14106 diff --git a/Content/UI/NameBar_UI/Hp_UI.uasset b/Content/UI/NameBar_UI/Hp_UI.uasset new file mode 100644 index 0000000..e6f88ce --- /dev/null +++ b/Content/UI/NameBar_UI/Hp_UI.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e6ecc3639214822da96a4b9d2f29be315e6d9e364219f7694e2c7b7b18d5d0d +size 10744 diff --git a/Content/UI/NameBar_UI/NameBar_UI.uasset b/Content/UI/NameBar_UI/NameBar_UI.uasset new file mode 100644 index 0000000..15fde60 --- /dev/null +++ b/Content/UI/NameBar_UI/NameBar_UI.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbd86d0f18bc22c27040bb40d268b9d83d502a7885dfc02fceaf79bdf8f28bf7 +size 76313 diff --git a/Source/Promether/AnimNotify/AN_Skill4_End.cpp b/Source/Promether/AnimNotify/AN_Skill4_End.cpp new file mode 100644 index 0000000..6b1afdc --- /dev/null +++ b/Source/Promether/AnimNotify/AN_Skill4_End.cpp @@ -0,0 +1,14 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "AN_Skill4_End.h" + +#include "../PlayerGeneric/DefaultPlayerCharacter.h" + +void UAN_Skill4_End::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) +{ + ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner(); + if (!MyCharacter) return; + + MyCharacter->Skill4_End(); +} diff --git a/Source/Promether/AnimNotify/AN_Skill4_End.h b/Source/Promether/AnimNotify/AN_Skill4_End.h new file mode 100644 index 0000000..e2750dd --- /dev/null +++ b/Source/Promether/AnimNotify/AN_Skill4_End.h @@ -0,0 +1,19 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Animation/AnimNotifies/AnimNotify.h" +#include "AN_Skill4_End.generated.h" + +/** + * + */ +UCLASS() +class PROMETHER_API UAN_Skill4_End : public UAnimNotify +{ + GENERATED_BODY() + +public: + virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override; +}; diff --git a/Source/Promether/GameModeBase/Deathmatch.cpp b/Source/Promether/GameModeBase/Deathmatch.cpp index 8c6ea7e..db8175f 100644 --- a/Source/Promether/GameModeBase/Deathmatch.cpp +++ b/Source/Promether/GameModeBase/Deathmatch.cpp @@ -133,7 +133,7 @@ FString ADeathmatch::InitNewPlayer(APlayerController* NewPlayerController, const //DebugPerpose if (Type == CharacterType::Lukriel) { - Type = CharacterType::Allium; + Type = CharacterType::Lb; } if (Team == TeamType::Null) { diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp index 76e1f35..ceb44e9 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp @@ -24,40 +24,12 @@ 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); - Health = 0.0f; - HPRegeneration = 0.0f; - HealAndShieldpower = 0.0f; - Armor = 0.0f; - MagicResistance = 0.0f; - Tenacity = 0.0f; - SlowRisist = 0.0f; - AttackSpeed = 0.0f; - AttackDamage = 0.0f; - AbilityPower = 0.0f; - CriticalStrikeChance = 0.0f; - CriticalStrikeDamage = 0.0f; - ArmorPenetration = 0.0f; - MagicPenetration = 0.0f; - LifeSteal = 0.0f; - PhysicalVamp = 0.0f; - Omnivamp = 0.0f; - AbilityHaste = 0.0f; - Mana = 0.0f; - ManaRegeneration = 0.0f; - Energy = 0.0f; - EnergyRegeneration = 0.0f; - AttackRange = 0.0f; - MovementSpeed = 0.0f; - GoldGeneration = 0.0f; - AttackDamageGrowth = 0.0f; - AttackSpeedGrowth = 0.0f; - ArmorGrowth = 0.0f; - MagicResistanceGrowth = 0.0f; - HealthGrowth = 0.0f; - HealthRegenerationGrowth = 0.0f; - ManaGrowth = 0.0f; - ManaRegenerationGrowth = 0.0f; + for (uint8 i = 0; i < (uint8)CooldownType::SIZE; i++) + CooldownDuration.Add((CooldownType)i, 0.0f); } void ADefaultPlayerCharacter::Tick(float DeltaTime) @@ -104,15 +76,15 @@ float ADefaultPlayerCharacter::TakeDamage_Implementation(float DamageAmount, str float ADDamageMultiplier = 0; float APDamageMultiplier = 0; - if (MyState->Stats.Armor >= 0) - ADDamageMultiplier = 100 / (100 + MyState->Stats.Armor); + if (MyState->Stats[(uint8)EStats::Armor] >= 0) + ADDamageMultiplier = 100 / (100 + MyState->Stats[(uint8)EStats::Armor]); else - ADDamageMultiplier = 2 - 100 / (100 - MyState->Stats.Armor); + ADDamageMultiplier = 2 - 100 / (100 - MyState->Stats[(uint8)EStats::Armor]); - if (MyState->Stats.MagicResistance >= 0) - APDamageMultiplier = 100 / (100 + MyState->Stats.MagicResistance); + if (MyState->Stats[(uint8)EStats::MagicResistance] >= 0) + APDamageMultiplier = 100 / (100 + MyState->Stats[(uint8)EStats::MagicResistance]); else - APDamageMultiplier = 2 - 100 / (100 - MyState->Stats.MagicResistance); + APDamageMultiplier = 2 - 100 / (100 - MyState->Stats[(uint8)EStats::MagicResistance]); UE_LOG(LogTemp, Warning, TEXT("%s : ADDamageMultiplier : %f CalculatedDamage : %f"), *DamageCauser->GetName(), ADDamageMultiplier, DamageAmount * ADDamageMultiplier); @@ -120,19 +92,19 @@ float ADefaultPlayerCharacter::TakeDamage_Implementation(float DamageAmount, str if (Cast(DamageEvent.DamageTypeClass->GetDefaultObject())) { - UE_LOG(LogTemp, Warning, TEXT("DamageType : BaseAttack")); + UE_LOG(LogTemp, Warning, TEXT("DamageType : BaseAttack")); - float UpdatedHealth = MyState->Stats.Health - EventInstigatorState->Stats.AttackDamage * ADDamageMultiplier; + float UpdatedHealth = MyState->Stats[(uint8)EStats::Health] - EventInstigatorState->Stats[(uint8)EStats::AttackDamage] * ADDamageMultiplier; if (UpdatedHealth < 0) { - MyState->Stats.Health = 0; + MyState->Stats[(uint8)EStats::Health] = 0; } else { - MyState->Stats.Health = UpdatedHealth; + MyState->Stats[(uint8)EStats::Health] = UpdatedHealth; } - UE_LOG(LogTemp, Warning, TEXT("Current Health : %f"), MyState->Stats.Health); + UE_LOG(LogTemp, Warning, TEXT("Current Health : %f"), MyState->Stats[(uint8)EStats::Health]); } } @@ -186,6 +158,16 @@ 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(); diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h index 9cfb097..7f8387d 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h @@ -65,6 +65,14 @@ public: 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 @@ -89,121 +97,14 @@ public: UFUNCTION(NetMulticast, Reliable) void NetMulticast_Skill7(); - float GetHealth() const { return Health; } - float GetHPRegeneration() const { return HPRegeneration; } - float GetHealAndShieldpower() const { return HealAndShieldpower; } - float GetArmor() const { return Armor; } - float GetMagicResistance() const { return MagicResistance; } - float GetTenacity() const { return Tenacity; } - float GetSlowRisist() const { return SlowRisist; } - float GetAttackSpeed() const { return AttackSpeed; } - float GetAttackDamage() const { return AttackDamage; } - float GetAbilityPower() const { return AbilityPower; } - float GetCriticalStrikeChance() const { return CriticalStrikeChance; } - float GetCriticalStrikeDamage() const { return CriticalStrikeDamage; } - float GetArmorPenetration() const { return ArmorPenetration; } - float GetMagicPenetration() const { return MagicPenetration; } - float GetLifeSteal() const { return LifeSteal; } - float GetPhysicalVamp() const { return PhysicalVamp; } - float GetOmnivamp() const { return Omnivamp; } - float GetAbilityHaste() const { return AbilityHaste; } - const float* GetCooldownDuration() const { return CooldownDuration; } - float GetMana() const { return Mana; } - float GetManaRegeneration() const { return ManaRegeneration; } - float GetEnergy() const { return Energy; } - float GetEnergyRegeneration() const { return EnergyRegeneration; } - float GetAttackRange() const { return AttackRange; } - float GetMovementSpeed() const { return MovementSpeed; } - float GetGoldGeneration() const { return GoldGeneration; } - float GetAttackDamageGrowth() const { return AttackDamageGrowth; } - float GetAttackSpeedGrowth() const { return AttackSpeedGrowth; } - float GetArmorGrowth() const { return ArmorGrowth; } - float GetMagicResistanceGrowth() const { return MagicResistanceGrowth; } - float GetHealthGrowth() const { return HealthGrowth; } - float GetHealthRegenerationGrowth() const { return HealthRegenerationGrowth; } - float GetManaGrowth() const { return ManaGrowth; } - float GetManaRegenerationGrowth() const { return ManaRegenerationGrowth; } + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats") + TMap DefaultStats; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats") + TMap CooldownDuration; protected: UPROPERTY(EditAnywhere) USpringArmComponent* CameraSpringArm; UPROPERTY(EditAnywhere) UCameraComponent* Camera; - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float Health; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float HPRegeneration; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float HealAndShieldpower; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float Armor; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float MagicResistance; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float Tenacity; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Defensive") - float SlowRisist; - - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float AttackSpeed; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float AttackDamage; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float AbilityPower; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float CriticalStrikeChance; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float CriticalStrikeDamage; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float ArmorPenetration; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float MagicPenetration; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float LifeSteal; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float PhysicalVamp; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Offensive") - float Omnivamp; - - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Haste") - float AbilityHaste; - - UPROPERTY(EditAnywhere, Category = "Stats|Utility|Haste") - float CooldownDuration[(uint8)CooldownType::SIZE] = { 0.0f, }; - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource") - float Mana; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource") - float ManaRegeneration; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource") - float Energy; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Resource") - float EnergyRegeneration; - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility") - float AttackRange; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility") - float MovementSpeed; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Utility|Non-Combat") - float GoldGeneration; - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float AttackDamageGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float AttackSpeedGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float ArmorGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float MagicResistanceGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float HealthGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float HealthRegenerationGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float ManaGrowth; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats|Increasing Statistics") - float ManaRegenerationGrowth; }; diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp index 6e6e94b..111935d 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp @@ -18,17 +18,19 @@ void ADefaultPlayerController::BeginPlay() { Super::BeginPlay(); - if (ULocalPlayer* LocalPlayer = Cast(Player)) { - if (UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem()) { - if (!PlayerInputMapping.IsNull()) { - InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0); - } - else { - UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed")); - } - } + ULocalPlayer* LocalPlayer = Cast(Player); + if (!LocalPlayer) return; + + UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem(); + if (!InputSystem) return; + + if (PlayerInputMapping.IsNull()) + { + UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed")); + return; } + InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0); this->bShowMouseCursor = true; } @@ -39,16 +41,29 @@ void ADefaultPlayerController::OnPossess(APawn* aPawn) Server_SpawnPlayerCamera(); AActor *PlayerCamera = GetPlayerState()->GetPlayerCamera(); - if (PlayerCamera) - { - SetViewTarget(PlayerCamera); - - UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState()->GetPlayerCamera()->GetName()); - } - else + if (!PlayerCamera) { UE_LOG(LogTemp, Error, TEXT("GetPlayerCamera Failed.")); + return; } + + SetViewTarget(PlayerCamera); + + UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState()->GetPlayerCamera()->GetName()); + + ADefaultPlayerCharacter* ControlledPawn = GetPawn(); + if (!ControlledPawn) return; + + ADefaultPlayerState* MyPlayerState = GetPlayerState(); + if (!MyPlayerState) return; + + TArray DefaultStatsValue; + TArray CooldownDurationValue; + + ControlledPawn->DefaultStats.GenerateValueArray(DefaultStatsValue); + ControlledPawn->CooldownDuration.GenerateValueArray(CooldownDurationValue); + + MyPlayerState->InitPlayerStats(DefaultStatsValue, CooldownDurationValue); } void ADefaultPlayerController::OnUnPossess() @@ -66,48 +81,46 @@ void ADefaultPlayerController::Server_SpawnPlayerCamera_Implementation() UE_LOG(LogTemp, Warning, TEXT("SpawnPlayerCamera")); - if (APawn* MyPawn = GetPawn()) + APawn* MyPawn = GetPawn(); + if (!MyPawn) return; + + FTransform SpawnTransform = FTransform(); + + SpawnTransform.SetLocation(MyPawn->GetActorLocation()); + + OutContextPlayerCamera = GetWorld()->SpawnActor(ADefaultPlayerCamera::StaticClass(), SpawnTransform, SpawnInfo); + if (!OutContextPlayerCamera) { - FTransform SpawnTransform = FTransform(); - - SpawnTransform.SetLocation(MyPawn->GetActorLocation()); - - OutContextPlayerCamera = GetWorld()->SpawnActor(ADefaultPlayerCamera::StaticClass(), SpawnTransform, SpawnInfo); - if (OutContextPlayerCamera) - { - GetPlayerState()->SetPlayerCamera(OutContextPlayerCamera); - OutContextPlayerCamera->AttachToActor(GetPawn(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, false)); - - UE_LOG(LogTemp, Warning, TEXT("SetPlayerCamera Success : %s, %d"), *GetPlayerState()->GetPlayerCamera()->GetName(), GetPlayerState()->GetPlayerCamera()); - } - else - { - UE_LOG(LogTemp, Error, TEXT("Camera Spawn Failed.")); - } + UE_LOG(LogTemp, Error, TEXT("Camera Spawn Failed.")); + return; } + + GetPlayerState()->SetPlayerCamera(OutContextPlayerCamera); + OutContextPlayerCamera->AttachToActor(GetPawn(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, false)); + + UE_LOG(LogTemp, Warning, TEXT("SetPlayerCamera Success : %s, %d"), *GetPlayerState()->GetPlayerCamera()->GetName(), GetPlayerState()->GetPlayerCamera()); } void ADefaultPlayerController::SetACharacterOutlineColor(ACharacter* Target, bool Visible) { - if (!HasAuthority()) + if (HasAuthority()) return; + + ADefaultPlayerState* State = Target->GetPlayerState(); + if (!State) { - if (ADefaultPlayerState* State = Target->GetPlayerState()) - { - if (State->GetTeam() == GetPlayerState()->GetTeam()) - { - Target->GetMesh()->SetRenderCustomDepth(Visible); - Target->GetMesh()->CustomDepthStencilValue = 1; - } - else - { - Target->GetMesh()->SetRenderCustomDepth(Visible); - Target->GetMesh()->CustomDepthStencilValue = 2; - } - } - else - { - UE_LOG(LogTemp, Error, TEXT("GetPlayerState Failed")); - } + UE_LOG(LogTemp, Error, TEXT("GetPlayerState Failed")); + return; + } + + if (State->GetTeam() == GetPlayerState()->GetTeam()) + { + Target->GetMesh()->SetRenderCustomDepth(Visible); + Target->GetMesh()->CustomDepthStencilValue = 1; + } + else + { + Target->GetMesh()->SetRenderCustomDepth(Visible); + Target->GetMesh()->CustomDepthStencilValue = 2; } } @@ -215,34 +228,36 @@ void ADefaultPlayerController::SetupInputComponent() { Super::SetupInputComponent(); - if (UEnhancedInputComponent* EnhancedInputComponent = Cast(InputComponent)) - { - 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::Skill4); - 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::MoveTriggered); - EnhancedInputComponent->BindAction(MoveAction.Get(), ETriggerEvent::Started, this, &ADefaultPlayerController::MoveStarted); - } + 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.Mana >= 100)) - // return; + if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill1Cost])) + return; + ACharacter* HitObject = nullptr; FVector Location = GetPawn()->GetActorLocation(); Location.Z = 0; - SimpleMoveToLocation(this, Location); - this->MoveToLocation(Location); + Server_StopMove(); + Multicast_StopMove(); - GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + Multicast_SetRotation(GetMouseHitLocation()); + Server_SetRotation(GetMouseHitLocation()); UE_LOG(LogTemp, Warning, TEXT("Skill1")); GetPlayerState()->SetState(ECharacterState::Attack); @@ -251,13 +266,18 @@ void ADefaultPlayerController::Skill1() void ADefaultPlayerController::Skill2() { + if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill2Cost])) + return; + + ACharacter* HitObject = nullptr; FVector Location = GetPawn()->GetActorLocation(); Location.Z = 0; - SimpleMoveToLocation(this, Location); - this->MoveToLocation(Location); + Server_StopMove(); + Multicast_StopMove(); - GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + Multicast_SetRotation(GetMouseHitLocation()); + Server_SetRotation(GetMouseHitLocation()); UE_LOG(LogTemp, Warning, TEXT("Skill2")); GetPlayerState()->SetState(ECharacterState::Attack); @@ -266,32 +286,49 @@ void ADefaultPlayerController::Skill2() void ADefaultPlayerController::Skill3() { + if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill3Cost])) + return; + + ACharacter* HitObject = nullptr; FVector Location = GetPawn()->GetActorLocation(); Location.Z = 0; - SimpleMoveToLocation(this, Location); - this->MoveToLocation(Location); + Server_StopMove(); + Multicast_StopMove(); - GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + Multicast_SetRotation(GetMouseHitLocation()); + Server_SetRotation(GetMouseHitLocation()); UE_LOG(LogTemp, Warning, TEXT("Skill3")); GetPlayerState()->SetState(ECharacterState::Attack); GetPlayerState()->SetAttackType(CooldownType::Skill3); } -void ADefaultPlayerController::Skill4() +void ADefaultPlayerController::Skill4Triggered() { + if (!(GetPlayerState()->Stats[(uint8)EStats::Mana] >= GetPlayerState()->Stats[(uint8)EStats::Skill4Cost])) + return; + + ACharacter* HitObject = nullptr; FVector Location = GetPawn()->GetActorLocation(); Location.Z = 0; - SimpleMoveToLocation(this, Location); - this->MoveToLocation(Location); + Server_StopMove(); + Multicast_StopMove(); - GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + Multicast_SetRotation(GetMouseHitLocation()); + Server_SetRotation(GetMouseHitLocation()); - UE_LOG(LogTemp, Warning, TEXT("Skill4")); + UE_LOG(LogTemp, Warning, TEXT("Skill4 Triggered")); GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill4Started); + GetPlayerState()->SetAttackType(CooldownType::Skill4Triggered); +} + +void ADefaultPlayerController::Skill4Completed() +{ + UE_LOG(LogTemp, Warning, TEXT("Skill4 Completed")); + GetPlayerState()->SetState(ECharacterState::Attack); + GetPlayerState()->SetAttackType(CooldownType::Skill4Comlpleted); } void ADefaultPlayerController::RuneSpell1() @@ -331,30 +368,73 @@ void ADefaultPlayerController::ObjectSelect() GetHitResultUnderCursorForObjects(ObjectTypes, true, HitResult); - if (ACharacter* HitObject = Cast(HitResult.GetActor())) - { - UE_LOG(LogTemp, Warning, TEXT("%s"), *HitObject->GetName()); - SetACharacterOutlineColor(HitObject, true); - } + ACharacter* HitObject = Cast(HitResult.GetActor()); + if (!HitObject) return; + + UE_LOG(LogTemp, Warning, TEXT("%s"), *HitObject->GetName()); + SetACharacterOutlineColor(HitObject, true); } -void ADefaultPlayerController::MoveTriggered() -{ - Move(); -} - -void ADefaultPlayerController::MoveStarted() -{ - Move(); -} void ADefaultPlayerController::Move() { - FVector Destination = GetMouseHitLocation(); + FHitResult HitResult; + TArray> ObjectTypes; + ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_WorldStatic)); + ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn)); - GetPlayerState()->SetState(ECharacterState::Moving); - SimpleMoveToLocation(this, Destination); - this->MoveToLocation(Destination); + GetHitResultUnderCursorForObjects(ObjectTypes, true, HitResult); + ACharacter* HitObject = Cast(HitResult.GetActor()); //¿ÀºêÁ§Æ®¸¦ °¡Á®¿Í HitCharactor¿¡ ÀúÀå<<ÃßÈÄ Àû ij¸¯ÅÍÀ϶§¸¸ ÀúÀåÀ¸·Î º¯°æÇؾßÇÔ + + if (HitObject != nullptr) //Áö±ÝÀº HitObject°¡ nullÀÌ ¾Æ´Ò °æ¿ì Attack()À» ½ÇÇàÇÏ´Â ÄÚµåÁö¸¸, HitObject°¡ Àû ij¸¯ÅÍÀÏ ¶§ ½ÇÇàÀ¸·Î º¯°æÇؾßÇÔ + { + + Attack(HitObject); //HitObject¸¦ ´ë»óÀ¸·Î Attack ½ÇÇà + } + else + { + HitObject = nullptr; + FVector Destination = GetMouseHitLocation(); + GetPlayerState()->SetState(ECharacterState::Moving); + SimpleMoveToLocation(this, Destination); + this->MoveToLocation(Destination); + } + +} + + + + + + +void ADefaultPlayerController::Multicast_SetRotation_Implementation(FVector MouseHitLocation) +{ + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + GetPawn()->SetActorRotation((MouseHitLocation - Location).Rotation()); +} + +void ADefaultPlayerController::Server_SetRotation_Implementation(FVector MouseHitLocation) +{ + Multicast_SetRotation(MouseHitLocation); +} + +void ADefaultPlayerController::Server_StopMove_Implementation() +{ + Multicast_StopMove(); +} + +void ADefaultPlayerController::Multicast_StopMove_Implementation() +{ + UPathFollowingComponent* PFollowComp = this->FindComponentByClass(); + if (!PFollowComp) return; + + PFollowComp->OnRequestFinished.Clear(); + + PFollowComp->RequestMoveWithImmediateFinish(EPathFollowingResult::Success); + + PFollowComp->OnRequestFinished.AddUObject(this, &ADefaultPlayerController::OnMoveCompleted); } FVector ADefaultPlayerController::GetMouseHitLocation() @@ -363,7 +443,7 @@ FVector ADefaultPlayerController::GetMouseHitLocation() GetHitResultUnderCursor(ECollisionChannel::ECC_Visibility, true, HitResult); HitResult.Location.Z = 0; - UE_LOG(LogTemp, Warning, TEXT("Client%d MoveTo : (%f, %f)"), GPlayInEditorID, HitResult.Location.X, HitResult.Location.Y); + //UE_LOG(LogTemp, Warning, TEXT("Client%d MoveTo : (%f, %f)"), GPlayInEditorID, HitResult.Location.X, HitResult.Location.Y); FVector ActorLocation = GetPawn()->GetActorLocation(); ActorLocation.Z = 0; @@ -376,22 +456,21 @@ FVector ADefaultPlayerController::GetMouseHitLocation() DrawDebugLine(GetWorld(), HitResult.Location, Destination, FColor::Emerald, false, 1, 0, 1); const UWorld* CurrentWorld = GetWorld(); - if (CurrentWorld) - { - FHitResult CollisionCheck; + if (!CurrentWorld) return Destination; - FCollisionQueryParams CollisionParams; - CollisionParams.AddIgnoredActor(GetPawn()); + FHitResult CollisionCheck; - FVector Start = HitResult.Location; - FVector End = Destination; + FCollisionQueryParams CollisionParams; + CollisionParams.AddIgnoredActor(GetPawn()); - if (CurrentWorld->LineTraceSingleByChannel(CollisionCheck, Start, End, ECC_Visibility, CollisionParams)) - { - DrawDebugLine(CurrentWorld, Start, End, FColor::Red, false, 1.5, 0, 2); - Destination = HitResult.Location; - } - } + FVector Start = HitResult.Location; + FVector End = Destination; + + if (!CurrentWorld->LineTraceSingleByChannel(CollisionCheck, Start, End, ECC_Visibility, CollisionParams)) + return Destination; + + DrawDebugLine(CurrentWorld, Start, End, FColor::Red, false, 1.5, 0, 2); + Destination = HitResult.Location; return Destination; } @@ -476,25 +555,71 @@ void ADefaultPlayerController::SimpleMoveToLocation(AController* Controller, con void ADefaultPlayerController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& MovementResult) { - if (MovementResult.IsSuccess()) + if (!MovementResult.IsSuccess()) return; + + if (!GPlayInEditorID) { - if (!GPlayInEditorID) + UE_LOG(LogTemp, Warning, TEXT("Server MoveCompleted")); + } + else + { + UE_LOG(LogTemp, Warning, TEXT("Client%d MoveCompleted"), GPlayInEditorID); + } + + GetPlayerState()->SetState(ECharacterState::Idle); +} + +void ADefaultPlayerController::Attack(ACharacter* HitObject) +{ + + float MinDistance = GetPlayerState()->Stats[(uint8)EStats:: AttackRange]; + FVector Destination = HitObject->GetActorLocation(); // HitObjectÀÇ À§Ä¡¸¦ ¸ñÀûÁö·Î ¼³Á¤ + if (FVector::Dist(Destination, GetPawn()->GetActorLocation()) <= MinDistance) { - UE_LOG(LogTemp, Warning, TEXT("Server MoveCompleted")); + if ((GetPlayerState()->CooldownDuration[(uint8)CooldownType::Attack] == 0)) + { + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + Server_StopMove(); + Multicast_StopMove(); + + Multicast_SetRotation(GetMouseHitLocation()); + Server_SetRotation(GetMouseHitLocation()); + + UE_LOG(LogTemp, Warning, TEXT("Attack")); + GetPlayerState()->SetState(ECharacterState::Attack); + GetPlayerState()->SetAttackType(CooldownType::Attack); + } + else + { + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + Server_StopMove(); + Multicast_StopMove(); + + Multicast_SetRotation(GetMouseHitLocation()); + Server_SetRotation(GetMouseHitLocation()); + + UE_LOG(LogTemp, Warning, TEXT("Attack")); + GetPlayerState()->SetState(ECharacterState::Idle); + GetPlayerState()->SetAttackType(CooldownType::Attack); + } + } else { - UE_LOG(LogTemp, Warning, TEXT("Client%d MoveCompleted"), GPlayInEditorID); + GetPlayerState()->SetState(ECharacterState::Moving); + SimpleMoveToLocation(this, Destination); + + Destination = HitObject->GetActorLocation(); // HitObjectÀÇ À§Ä¡¸¦ ¸ñÀûÁö·Î ¼³Á¤ + this->MoveToLocation(Destination); + + } - GetPlayerState()->SetState(ECharacterState::Idle); - } -} -void ADefaultPlayerController::Attack() -{ - UE_LOG(LogTemp, Warning, TEXT("Attack")); - GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Attack); + } void ADefaultPlayerController::MoveToLocation_Implementation(FVector Location) diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerController.h b/Source/Promether/PlayerGeneric/DefaultPlayerController.h index 22d92c7..166d56d 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerController.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerController.h @@ -34,19 +34,29 @@ public: void Skill1(); void Skill2(); void Skill3(); - void Skill4(); + void Skill4Triggered(); + void Skill4Completed(); void RuneSpell1(); void RuneSpell2(); void Ward(); void Bomb(); void ObjectSelect(); - void MoveTriggered(); - void MoveStarted(); void Move(); UFUNCTION(Server, Reliable) void MoveToLocation(FVector Location); + UFUNCTION(Server, Reliable) + void Server_StopMove(); + UFUNCTION(NetMulticast, Reliable) + void Multicast_StopMove(); + + UFUNCTION(NetMulticast, Reliable) + void Multicast_SetRotation(FVector MouseHitLocation); + + UFUNCTION(Server, Reliable) + void Server_SetRotation(FVector MouseHitLocation); + FVector GetMouseHitLocation(); UFUNCTION(BlueprintCallable, Category = "AI|Navigation") @@ -54,7 +64,9 @@ public: void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult &MovementResult); - void Attack(); + + + void Attack(ACharacter* HitObject); UPROPERTY(BlueprintReadWrite) float MouseClickInterval; diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp index f8468af..1159af6 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerState.cpp @@ -26,46 +26,18 @@ void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray& DOREPLIFETIME(ADefaultPlayerState, PlayerCamera); } -void ADefaultPlayerState::InitPlayerStats() +void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray& StatsValue, const TArray& CooldownDurationValue) { - ADefaultPlayerCharacter* Initializer = Cast(CharacterBPRef); + MaxStats.Append(StatsValue); + Stats.Append(StatsValue); + CooldownDuration.Append(CooldownDurationValue); + MaxCooldownDuration.Append(CooldownDurationValue); - Stats.Health = Initializer->GetHealth(); - Stats.HPRegeneration = Initializer->GetHPRegeneration(); - Stats.HealAndShieldpower = Initializer->GetHealAndShieldpower(); - Stats.Armor = Initializer->GetArmor(); - Stats.MagicResistance = Initializer->GetMagicResistance(); - Stats.Tenacity = Initializer->GetTenacity(); - Stats.SlowRisist = Initializer->GetSlowRisist(); - Stats.AttackSpeed = Initializer->GetAttackSpeed(); - Stats.AttackDamage = Initializer->GetAttackDamage(); - Stats.AbilityPower = Initializer->GetAbilityPower(); - Stats.CriticalStrikeChance = Initializer->GetCriticalStrikeChance(); - Stats.CriticalStrikeDamage = Initializer->GetCriticalStrikeDamage(); - Stats.ArmorPenetration = Initializer->GetArmorPenetration(); - Stats.MagicPenetration = Initializer->GetMagicPenetration(); - Stats.LifeSteal = Initializer->GetLifeSteal(); - Stats.PhysicalVamp = Initializer->GetPhysicalVamp(); - Stats.Omnivamp = Initializer->GetOmnivamp(); - Stats.AbilityHaste = Initializer->GetAbilityHaste(); - SetMultipleCooldownDuration(Initializer->GetCooldownDuration()); - - Stats.Mana = Initializer->GetMana(); - Stats.ManaRegeneration = Initializer->GetManaRegeneration(); - Stats.Energy = Initializer->GetEnergy(); - Stats.EnergyRegeneration = Initializer->GetEnergyRegeneration(); - Stats.AttackRange = Initializer->GetAttackRange(); - Stats.MovementSpeed = Initializer->GetMovementSpeed(); - Stats.GoldGeneration = Initializer->GetGoldGeneration(); - Stats.AttackDamageGrowth = Initializer->GetAttackDamageGrowth(); - Stats.AttackSpeedGrowth = Initializer->GetAttackSpeedGrowth(); - Stats.ArmorGrowth = Initializer->GetArmorGrowth(); - Stats.MagicResistanceGrowth = Initializer->GetMagicResistanceGrowth(); - Stats.HealthGrowth = Initializer->GetHealthGrowth(); - Stats.HealthRegenerationGrowth = Initializer->GetHealthRegenerationGrowth(); - Stats.ManaGrowth = Initializer->GetManaGrowth(); - Stats.ManaRegenerationGrowth = Initializer->GetManaRegenerationGrowth(); + for (float Value : StatsValue) + { + UE_LOG(LogTemp, Warning, TEXT("Values: %f"), Value); + } } void ADefaultPlayerState::NetMulticast_SetAttackType_Implementation(CooldownType Value) @@ -92,8 +64,3 @@ int32 ADefaultPlayerState::GetCharacterLevel() const { return int32(); } - -void ADefaultPlayerState::SetMultipleCooldownDuration(const float* Value) -{ - std::memcpy(&CooldownDuration, Value, sizeof(float) * (uint8)CooldownType::SIZE); -} diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerState.h b/Source/Promether/PlayerGeneric/DefaultPlayerState.h index 7b64d67..d566af0 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerState.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerState.h @@ -21,7 +21,8 @@ public: ADefaultPlayerState(); void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override; - void InitPlayerStats(); + UFUNCTION(Server, Reliable) + void InitPlayerStats(const TArray& StatsValue, const TArray& CooldownDurationValue); void SetCharacterBPRef(UClass* Value) { CharacterBPRef = Value; } UClass* GetCharacterBPRef() const { return CharacterBPRef; } @@ -34,10 +35,11 @@ public: void SetPlayerCamera(AActor* Actor) { PlayerCamera = Actor; } AActor* GetPlayerCamera() const { return PlayerCamera; } - UFUNCTION(BlueprintCallable) - void SetCooldownDuration(CooldownType Key, float Value) { CooldownDuration[(uint8)Key] = Value; } - UFUNCTION(BlueprintCallable) - float GetCooldownDuration(CooldownType Key) const { return CooldownDuration[(uint8)Key]; } + //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) @@ -57,14 +59,16 @@ public: UFUNCTION(BlueprintCallable) int32 GetCharacterLevel() const; - - //Should be ONLY executed on server!! - void SetMultipleCooldownDuration(const float* Value) ; - UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite) - FDefaultStats Stats; - UPROPERTY(Replicated, EditAnywhere, BlueprintReadWrite) - FDefaultStats MaxStats; + UPROPERTY(Replicated, Transient, EditAnywhere, BlueprintReadWrite) + TArray Stats; + UPROPERTY(Replicated, Transient, EditAnywhere, BlueprintReadWrite) + TArray MaxStats; + + UPROPERTY(Replicated, Transient, BlueprintReadWrite) + TArray CooldownDuration; + UPROPERTY(Replicated, Transient, BlueprintReadWrite) + TArray MaxCooldownDuration; private: UPROPERTY(Replicated, Transient) @@ -72,9 +76,6 @@ private: UPROPERTY(Replicated, Transient) TeamType Team; - UPROPERTY(Replicated, Transient) - float CooldownDuration[(uint8)CooldownType::SIZE] = { 0.0f, }; - UPROPERTY(Replicated, Transient) ECharacterState State; UPROPERTY(Replicated, Transient) diff --git a/Source/Promether/PlayerGeneric/PerformSkill.cpp b/Source/Promether/PlayerGeneric/PerformSkill.cpp deleted file mode 100644 index 1d1dd9f..0000000 --- a/Source/Promether/PlayerGeneric/PerformSkill.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "PerformSkill.h" - -// Add default functionality here for any IPerformSkill functions that are not pure virtual. diff --git a/Source/Promether/PlayerGeneric/PerformSkill.h b/Source/Promether/PlayerGeneric/PerformSkill.h deleted file mode 100644 index ee6f11b..0000000 --- a/Source/Promether/PlayerGeneric/PerformSkill.h +++ /dev/null @@ -1,28 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/Interface.h" -#include "PerformSkill.generated.h" - -// This class does not need to be modified. -UINTERFACE(MinimalAPI) -class UPerformSkill : public UInterface -{ - GENERATED_BODY() -}; - -/** - * - */ -class PROMETHER_API IPerformSkill -{ - GENERATED_BODY() - - // Add interface functions to this class. This is the class that will be inherited to implement this interface. -public: - virtual void Skill4Started() = 0; - virtual void Skill4Triggered() = 0; - virtual void Skill4Completed() = 0; -}; diff --git a/Source/Promether/PrometherEnum.h b/Source/Promether/PrometherEnum.h index 1fb193f..e2d31e4 100644 --- a/Source/Promether/PrometherEnum.h +++ b/Source/Promether/PrometherEnum.h @@ -91,3 +91,45 @@ struct FUniqueObjectID int32 RandomUniqueNumber; }; +UENUM(BlueprintType) +enum class EStats : uint8 +{ + Health, + HPRegeneration, + HealAndShieldpower, + Armor, + MagicResistance, + Tenacity, + SlowRisist, + AttackSpeed, + AttackDamage, + AbilityPower, + CriticalStrikeChance, + CriticalStrikeDamage, + ArmorPenetration, + MagicPenetration, + LifeSteal, + PhysicalVamp, + Omnivamp, + AbilityHaste, + Mana, + ManaRegeneration, + Energy, + EnergyRegeneration, + AttackRange, + MovementSpeed, + GoldGeneration, + AttackDamageGrowth, + AttackSpeedGrowth, + ArmorGrowth, + MagicResistanceGrowth, + HealthGrowth, + HealthRegenerationGrowth, + ManaGrowth, + ManaRegenerationGrowth, + Skill1Cost, + Skill2Cost, + Skill3Cost, + Skill4Cost, + SIZE +}; \ No newline at end of file