From 97e13694dd0cd5058e1412dde2735a7aa8e4d762 Mon Sep 17 00:00:00 2001 From: HappyTanuki Date: Tue, 3 Oct 2023 00:36:50 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content/Character/Lb/Animation/ABP_Lb.uasset | 4 +- Content/Character/Lb/BP_Lb.uasset | 4 +- Content/Maps/DevMap.umap | 4 +- .../PlayerGeneric/DefaultPlayerController.cpp | 51 +++++++++++++++++-- .../PlayerGeneric/DefaultPlayerController.h | 2 + .../Promether/PlayerGeneric/PerformSkill.cpp | 6 +++ Source/Promether/PlayerGeneric/PerformSkill.h | 28 ++++++++++ Source/Promether/PrometherEnum.h | 4 +- 8 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 Source/Promether/PlayerGeneric/PerformSkill.cpp create mode 100644 Source/Promether/PlayerGeneric/PerformSkill.h diff --git a/Content/Character/Lb/Animation/ABP_Lb.uasset b/Content/Character/Lb/Animation/ABP_Lb.uasset index df4122c..7608da2 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:2a25a592d826825d1d3b4bac2adab7cd96a99a926a53db64b45b955d529e9d3f -size 263503 +oid sha256:af6cb9237f08342613ad4d82d44cd4691193b8a19a22d6c731ffca4fe3f71a5a +size 288811 diff --git a/Content/Character/Lb/BP_Lb.uasset b/Content/Character/Lb/BP_Lb.uasset index b8b2dbc..2f11bd8 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:fb4ac8c87b1fc6b97f11da1e4c96955ec7cc478b87821469a132e17d99894a25 -size 109032 +oid sha256:cd49a364363da955b7f1b9eec5131039ebf98c0263c1080cfe69d0ffa30e0c5c +size 108615 diff --git a/Content/Maps/DevMap.umap b/Content/Maps/DevMap.umap index 2404469..2e2ea30 100644 --- a/Content/Maps/DevMap.umap +++ b/Content/Maps/DevMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac7da83d7b779f1b7ad2bc245f2034fec5d7919f3a74faaa2cf26b6ffe72cf12 -size 181094 +oid sha256:46c65a21bc1a1bb56499b9c4d3e3893424aa3d2b9963803894eddff6a17fcf1e +size 181095 diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp b/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp index dd7f184..6e6e94b 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp +++ b/Source/Promether/PlayerGeneric/DefaultPlayerController.cpp @@ -233,6 +233,17 @@ void ADefaultPlayerController::SetupInputComponent() void ADefaultPlayerController::Skill1() { + //if (!(GetPlayerState()->Stats.Mana >= 100)) + // return; + + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + SimpleMoveToLocation(this, Location); + this->MoveToLocation(Location); + + GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + UE_LOG(LogTemp, Warning, TEXT("Skill1")); GetPlayerState()->SetState(ECharacterState::Attack); GetPlayerState()->SetAttackType(CooldownType::Skill1); @@ -240,6 +251,14 @@ void ADefaultPlayerController::Skill1() void ADefaultPlayerController::Skill2() { + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + SimpleMoveToLocation(this, Location); + this->MoveToLocation(Location); + + GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + UE_LOG(LogTemp, Warning, TEXT("Skill2")); GetPlayerState()->SetState(ECharacterState::Attack); GetPlayerState()->SetAttackType(CooldownType::Skill2); @@ -247,6 +266,14 @@ void ADefaultPlayerController::Skill2() void ADefaultPlayerController::Skill3() { + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + SimpleMoveToLocation(this, Location); + this->MoveToLocation(Location); + + GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + UE_LOG(LogTemp, Warning, TEXT("Skill3")); GetPlayerState()->SetState(ECharacterState::Attack); GetPlayerState()->SetAttackType(CooldownType::Skill3); @@ -254,9 +281,17 @@ void ADefaultPlayerController::Skill3() void ADefaultPlayerController::Skill4() { + FVector Location = GetPawn()->GetActorLocation(); + Location.Z = 0; + + SimpleMoveToLocation(this, Location); + this->MoveToLocation(Location); + + GetPawn()->SetActorRotation((GetMouseHitLocation() - Location).Rotation()); + UE_LOG(LogTemp, Warning, TEXT("Skill4")); GetPlayerState()->SetState(ECharacterState::Attack); - GetPlayerState()->SetAttackType(CooldownType::Skill4); + GetPlayerState()->SetAttackType(CooldownType::Skill4Started); } void ADefaultPlayerController::RuneSpell1() @@ -314,6 +349,15 @@ void ADefaultPlayerController::MoveStarted() } void ADefaultPlayerController::Move() +{ + FVector Destination = GetMouseHitLocation(); + + GetPlayerState()->SetState(ECharacterState::Moving); + SimpleMoveToLocation(this, Destination); + this->MoveToLocation(Destination); +} + +FVector ADefaultPlayerController::GetMouseHitLocation() { FHitResult HitResult; GetHitResultUnderCursor(ECollisionChannel::ECC_Visibility, true, HitResult); @@ -325,6 +369,7 @@ void ADefaultPlayerController::Move() ActorLocation.Z = 0; float CapsuleRadius = GetPawn()->GetCapsuleComponent()->GetScaledCapsuleRadius(); + FVector Destination = (HitResult.Location - ActorLocation).GetSafeNormal() * CapsuleRadius + HitResult.Location; DrawDebugLine(GetWorld(), ActorLocation, HitResult.Location, FColor::Blue, false, 1, 0, 1); @@ -348,9 +393,7 @@ void ADefaultPlayerController::Move() } } - GetPlayerState()->SetState(ECharacterState::Moving); - SimpleMoveToLocation(this, Destination); - this->MoveToLocation(Destination); + return Destination; } void ADefaultPlayerController::SimpleMoveToLocation(AController* Controller, const FVector& GoalLocation) diff --git a/Source/Promether/PlayerGeneric/DefaultPlayerController.h b/Source/Promether/PlayerGeneric/DefaultPlayerController.h index 4b312bf..22d92c7 100644 --- a/Source/Promether/PlayerGeneric/DefaultPlayerController.h +++ b/Source/Promether/PlayerGeneric/DefaultPlayerController.h @@ -47,6 +47,8 @@ public: UFUNCTION(Server, Reliable) void MoveToLocation(FVector Location); + FVector GetMouseHitLocation(); + UFUNCTION(BlueprintCallable, Category = "AI|Navigation") void SimpleMoveToLocation(AController* Controller, const FVector& Goal); diff --git a/Source/Promether/PlayerGeneric/PerformSkill.cpp b/Source/Promether/PlayerGeneric/PerformSkill.cpp new file mode 100644 index 0000000..1d1dd9f --- /dev/null +++ b/Source/Promether/PlayerGeneric/PerformSkill.cpp @@ -0,0 +1,6 @@ +// 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 new file mode 100644 index 0000000..ee6f11b --- /dev/null +++ b/Source/Promether/PlayerGeneric/PerformSkill.h @@ -0,0 +1,28 @@ +// 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 1fcc679..1fb193f 100644 --- a/Source/Promether/PrometherEnum.h +++ b/Source/Promether/PrometherEnum.h @@ -36,7 +36,9 @@ enum class CooldownType : uint8 Skill1, Skill2, Skill3, - Skill4, + Skill4Started, + Skill4Triggered, + Skill4Comlpleted, RuneSpell1, RuneSpell2, Ward,