저장
This commit is contained in:
@@ -233,6 +233,17 @@ void ADefaultPlayerController::SetupInputComponent()
|
||||
|
||||
void ADefaultPlayerController::Skill1()
|
||||
{
|
||||
//if (!(GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill4);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill4Started);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::RuneSpell1()
|
||||
@@ -314,6 +349,15 @@ void ADefaultPlayerController::MoveStarted()
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Move()
|
||||
{
|
||||
FVector Destination = GetMouseHitLocation();
|
||||
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ACharacter>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
|
||||
SimpleMoveToLocation(this, Destination);
|
||||
this->MoveToLocation(Destination);
|
||||
return Destination;
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::SimpleMoveToLocation(AController* Controller, const FVector& GoalLocation)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
6
Source/Promether/PlayerGeneric/PerformSkill.cpp
Normal file
6
Source/Promether/PlayerGeneric/PerformSkill.cpp
Normal file
@@ -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.
|
||||
28
Source/Promether/PlayerGeneric/PerformSkill.h
Normal file
28
Source/Promether/PlayerGeneric/PerformSkill.h
Normal file
@@ -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;
|
||||
};
|
||||
@@ -36,7 +36,9 @@ enum class CooldownType : uint8
|
||||
Skill1,
|
||||
Skill2,
|
||||
Skill3,
|
||||
Skill4,
|
||||
Skill4Started,
|
||||
Skill4Triggered,
|
||||
Skill4Comlpleted,
|
||||
RuneSpell1,
|
||||
RuneSpell2,
|
||||
Ward,
|
||||
|
||||
Reference in New Issue
Block a user