복구
This commit is contained in:
15
Source/Promether.Target.cs
Normal file
15
Source/Promether.Target.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PrometherTarget : TargetRules
|
||||
{
|
||||
public PrometherTarget( TargetInfo Target) : base(Target)
|
||||
{
|
||||
Type = TargetType.Game;
|
||||
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||
ExtraModuleNames.Add("Promether");
|
||||
}
|
||||
}
|
||||
25
Source/Promether/AnimNotify/AN_AnimEnd.cpp
Normal file
25
Source/Promether/AnimNotify/AN_AnimEnd.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_AnimEnd.h"
|
||||
|
||||
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
|
||||
#include "../PlayerGeneric/DefaultPlayerState.h"
|
||||
|
||||
|
||||
void UAN_AnimEnd::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
|
||||
{
|
||||
|
||||
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
ADefaultPlayerState* MyState = MyCharacter->GetPlayerState<ADefaultPlayerState>();
|
||||
if (!MyState) return;
|
||||
MyState->SetState(ECharacterState::Idle);
|
||||
UE_LOG(LogTemp, Warning, TEXT("State log : %d"), MyState->GetState());
|
||||
MyState->Stats[(uint8)EStats::Attackable] = 0;
|
||||
MyState->Stats[(uint8)EStats::Skillusable] = 0;
|
||||
MyState->Stats[(uint8)EStats::Movable] = 0;
|
||||
|
||||
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_AnimEnd.h
Normal file
19
Source/Promether/AnimNotify/AN_AnimEnd.h
Normal file
@@ -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_AnimEnd.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_AnimEnd : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
|
||||
};
|
||||
15
Source/Promether/AnimNotify/AN_Attack.cpp
Normal file
15
Source/Promether/AnimNotify/AN_Attack.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Attack.h"
|
||||
#include "GameFramework/Controller.h"
|
||||
|
||||
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
|
||||
|
||||
void UAN_Attack::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
|
||||
{
|
||||
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
MyCharacter->Attack();
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_Attack.h
Normal file
19
Source/Promether/AnimNotify/AN_Attack.h
Normal file
@@ -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_Attack.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Attack : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
|
||||
};
|
||||
14
Source/Promether/AnimNotify/AN_Skill1.cpp
Normal file
14
Source/Promether/AnimNotify/AN_Skill1.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill1.h"
|
||||
|
||||
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
|
||||
|
||||
void UAN_Skill1::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
|
||||
{
|
||||
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
MyCharacter->Skill1();
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_Skill1.h
Normal file
19
Source/Promether/AnimNotify/AN_Skill1.h
Normal file
@@ -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_Skill1.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill1 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
|
||||
};
|
||||
14
Source/Promether/AnimNotify/AN_Skill2.cpp
Normal file
14
Source/Promether/AnimNotify/AN_Skill2.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill2.h"
|
||||
|
||||
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
|
||||
|
||||
void UAN_Skill2::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
|
||||
{
|
||||
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
MyCharacter->Skill2();
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_Skill2.h
Normal file
19
Source/Promether/AnimNotify/AN_Skill2.h
Normal file
@@ -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_Skill2.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill2 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
|
||||
};
|
||||
14
Source/Promether/AnimNotify/AN_Skill3.cpp
Normal file
14
Source/Promether/AnimNotify/AN_Skill3.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill3.h"
|
||||
|
||||
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
|
||||
|
||||
void UAN_Skill3::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
|
||||
{
|
||||
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
MyCharacter->Skill3();
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_Skill3.h
Normal file
19
Source/Promether/AnimNotify/AN_Skill3.h
Normal file
@@ -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_Skill3.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill3 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
|
||||
};
|
||||
14
Source/Promether/AnimNotify/AN_Skill4.cpp
Normal file
14
Source/Promether/AnimNotify/AN_Skill4.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill4.h"
|
||||
|
||||
#include "../PlayerGeneric/DefaultPlayerCharacter.h"
|
||||
|
||||
void UAN_Skill4::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference)
|
||||
{
|
||||
ADefaultPlayerCharacter* MyCharacter = MeshComp->GetOwner<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
MyCharacter->Skill4();
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_Skill4.h
Normal file
19
Source/Promether/AnimNotify/AN_Skill4.h
Normal file
@@ -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.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill4 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;
|
||||
};
|
||||
14
Source/Promether/AnimNotify/AN_Skill4_End.cpp
Normal file
14
Source/Promether/AnimNotify/AN_Skill4_End.cpp
Normal file
@@ -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<ADefaultPlayerCharacter>();
|
||||
if (!MyCharacter) return;
|
||||
|
||||
MyCharacter->Skill4_End();
|
||||
}
|
||||
19
Source/Promether/AnimNotify/AN_Skill4_End.h
Normal file
19
Source/Promether/AnimNotify/AN_Skill4_End.h
Normal file
@@ -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;
|
||||
};
|
||||
5
Source/Promether/AnimNotify/AN_Skill5.cpp
Normal file
5
Source/Promether/AnimNotify/AN_Skill5.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill5.h"
|
||||
|
||||
17
Source/Promether/AnimNotify/AN_Skill5.h
Normal file
17
Source/Promether/AnimNotify/AN_Skill5.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Animation/AnimNotifies/AnimNotify.h"
|
||||
#include "AN_Skill5.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill5 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
5
Source/Promether/AnimNotify/AN_Skill6.cpp
Normal file
5
Source/Promether/AnimNotify/AN_Skill6.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill6.h"
|
||||
|
||||
17
Source/Promether/AnimNotify/AN_Skill6.h
Normal file
17
Source/Promether/AnimNotify/AN_Skill6.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Animation/AnimNotifies/AnimNotify.h"
|
||||
#include "AN_Skill6.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill6 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
5
Source/Promether/AnimNotify/AN_Skill7.cpp
Normal file
5
Source/Promether/AnimNotify/AN_Skill7.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AN_Skill7.h"
|
||||
|
||||
17
Source/Promether/AnimNotify/AN_Skill7.h
Normal file
17
Source/Promether/AnimNotify/AN_Skill7.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Animation/AnimNotifies/AnimNotify.h"
|
||||
#include "AN_Skill7.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UAN_Skill7 : public UAnimNotify
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
5
Source/Promether/DamageType/BaseAttack.cpp
Normal file
5
Source/Promether/DamageType/BaseAttack.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "BaseAttack.h"
|
||||
|
||||
17
Source/Promether/DamageType/BaseAttack.h
Normal file
17
Source/Promether/DamageType/BaseAttack.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/DamageType.h"
|
||||
#include "BaseAttack.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UBaseAttack : public UDamageType
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
34
Source/Promether/DefaultGameInstance.cpp
Normal file
34
Source/Promether/DefaultGameInstance.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DefaultGameInstance.h"
|
||||
|
||||
UDefaultGameInstance::UDefaultGameInstance()
|
||||
{
|
||||
//ConstructorHelpers::FObjectFinder<UClass> LUKRIEL(TEXT(""));
|
||||
ConstructorHelpers::FObjectFinder<UClass> ALLIUM(TEXT("Class'/Game/Character/Allium/BP_Allium.BP_Allium_C'"));
|
||||
ConstructorHelpers::FObjectFinder<UClass> RIANA(TEXT("Class'/Game/Character/Riana/BP_Riana.BP_Riana_C'"));
|
||||
ConstructorHelpers::FObjectFinder<UClass> LB(TEXT("Class'/Game/Character/Lb/BP_Lb.BP_Lb_C'"));
|
||||
|
||||
if
|
||||
(
|
||||
//!LUKRIEL.Succeeded() ||
|
||||
!ALLIUM.Succeeded() ||
|
||||
!RIANA.Succeeded() ||
|
||||
!LB.Succeeded()
|
||||
)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Blueprint asset load failed."));
|
||||
return;
|
||||
}
|
||||
|
||||
BP_Characters[int(CharacterType::Lukriel)] = NULL;
|
||||
BP_Characters[int(CharacterType::Allium)] = ALLIUM.Object;
|
||||
BP_Characters[int(CharacterType::Riana)] = RIANA.Object;
|
||||
BP_Characters[int(CharacterType::Lb)] = LB.Object;
|
||||
}
|
||||
|
||||
void UDefaultGameInstance::Init()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("UDefaultGameInstance Loaded"));
|
||||
}
|
||||
25
Source/Promether/DefaultGameInstance.h
Normal file
25
Source/Promether/DefaultGameInstance.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "PrometherEnum.h"
|
||||
#include "DefaultGameInstance.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API UDefaultGameInstance : public UGameInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDefaultGameInstance();
|
||||
|
||||
virtual void Init() override;
|
||||
|
||||
UClass* GetCharacterBPRef(CharacterType Type) { return BP_Characters[(uint8)Type]; }
|
||||
|
||||
private:
|
||||
UPROPERTY()
|
||||
UClass* BP_Characters[(uint8)CharacterType::SIZE];
|
||||
};
|
||||
5
Source/Promether/DefaultGameStateBase.cpp
Normal file
5
Source/Promether/DefaultGameStateBase.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DefaultGameStateBase.h"
|
||||
|
||||
17
Source/Promether/DefaultGameStateBase.h
Normal file
17
Source/Promether/DefaultGameStateBase.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameStateBase.h"
|
||||
#include "DefaultGameStateBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API ADefaultGameStateBase : public AGameStateBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
151
Source/Promether/GameModeBase/Deathmatch.cpp
Normal file
151
Source/Promether/GameModeBase/Deathmatch.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Deathmatch.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "GameFramework/PlayerStart.h"
|
||||
#include "Engine/PlayerStartPIE.h"
|
||||
#include "EngineUtils.h"
|
||||
|
||||
#include "../PrometherEnum.h"
|
||||
#include "../PlayerGeneric/DefaultPlayerController.h"
|
||||
#include "../DefaultGameInstance.h"
|
||||
#include "../PlayerGeneric/DefaultPlayerState.h"
|
||||
#include "../DefaultGameStateBase.h"
|
||||
#include "../PlayerGeneric/DefaultPlayerCamera.h"
|
||||
|
||||
ADeathmatch::ADeathmatch()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
//DefaultPawnClass = AActor::StaticClass();
|
||||
PlayerControllerClass = ADefaultPlayerController::StaticClass();
|
||||
PlayerStateClass = ADefaultPlayerState::StaticClass();
|
||||
GameStateClass = ADefaultGameStateBase::StaticClass();
|
||||
}
|
||||
|
||||
void ADeathmatch::Tick(float DeltaSeconds)
|
||||
{
|
||||
/*
|
||||
UWorld* World = GetWorld();
|
||||
for (TActorIterator<AActor> It(World); It; ++It)
|
||||
{
|
||||
if (AController* Con = It->GetInstigatorController())
|
||||
{
|
||||
if (APlayerState* Sta = Con->GetPlayerState<APlayerState>())
|
||||
{
|
||||
if (ADefaultPlayerState* MyState = Cast<ADefaultPlayerState>(Sta))
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Server %s State = %d"), *It->GetName(), MyState->GetState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
AActor* ADeathmatch::ChoosePlayerStart_Implementation(AController* Player)
|
||||
{
|
||||
// Choose a player start
|
||||
APlayerStart* FoundPlayerStart = nullptr;
|
||||
|
||||
UClass* PawnClass = nullptr;
|
||||
if (ADefaultPlayerState* NewPlayerState = Player->GetPlayerState<ADefaultPlayerState>())
|
||||
{
|
||||
PawnClass = NewPlayerState->GetCharacterBPRef();
|
||||
}
|
||||
|
||||
APawn* PawnToFit = PawnClass ? PawnClass->GetDefaultObject<APawn>() : nullptr;
|
||||
TArray<APlayerStart*> UnOccupiedStartPoints;
|
||||
TArray<APlayerStart*> OccupiedStartPoints;
|
||||
UWorld* World = GetWorld();
|
||||
for (TActorIterator<APlayerStart> It(World); It; ++It)
|
||||
{
|
||||
APlayerStart* PlayerStart = *It;
|
||||
|
||||
if (PlayerStart->IsA<APlayerStartPIE>())
|
||||
{
|
||||
// Always prefer the first "Play from Here" PlayerStart, if we find one while in PIE mode
|
||||
FoundPlayerStart = PlayerStart;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FVector ActorLocation = PlayerStart->GetActorLocation();
|
||||
const FRotator ActorRotation = PlayerStart->GetActorRotation();
|
||||
if (!World->EncroachingBlockingGeometry(PawnToFit, ActorLocation, ActorRotation))
|
||||
{
|
||||
UnOccupiedStartPoints.Add(PlayerStart);
|
||||
}
|
||||
else if (World->FindTeleportSpot(PawnToFit, ActorLocation, ActorRotation))
|
||||
{
|
||||
OccupiedStartPoints.Add(PlayerStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (FoundPlayerStart == nullptr)
|
||||
{
|
||||
if (UnOccupiedStartPoints.Num() > 0)
|
||||
{
|
||||
FoundPlayerStart = UnOccupiedStartPoints[FMath::RandRange(0, UnOccupiedStartPoints.Num() - 1)];
|
||||
}
|
||||
else if (OccupiedStartPoints.Num() > 0)
|
||||
{
|
||||
FoundPlayerStart = OccupiedStartPoints[FMath::RandRange(0, OccupiedStartPoints.Num() - 1)];
|
||||
}
|
||||
}
|
||||
|
||||
return FoundPlayerStart;
|
||||
}
|
||||
|
||||
APawn* ADeathmatch::SpawnDefaultPawnAtTransform_Implementation(AController* NewPlayer, const FTransform& SpawnTransform)
|
||||
{
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
SpawnInfo.Instigator = GetInstigator();
|
||||
SpawnInfo.ObjectFlags |= RF_Transient; // We never want to save default player pawns into a map
|
||||
|
||||
UClass* PawnClass = nullptr;
|
||||
if (ADefaultPlayerState* NewPlayerState = NewPlayer->GetPlayerState<ADefaultPlayerState>())
|
||||
{
|
||||
PawnClass = NewPlayerState->GetCharacterBPRef();
|
||||
}
|
||||
|
||||
APawn* ResultPawn = GetWorld()->SpawnActor<APawn>(PawnClass, SpawnTransform, SpawnInfo);
|
||||
if (!ResultPawn)
|
||||
{
|
||||
UE_LOG(LogGameMode, Warning, TEXT("SpawnDefaultPawnAtTransform: Couldn't spawn Pawn of type %s at %s"), *GetNameSafe(PawnClass), *SpawnTransform.ToHumanReadableString());
|
||||
}
|
||||
|
||||
return ResultPawn;
|
||||
}
|
||||
|
||||
FString ADeathmatch::InitNewPlayer(APlayerController* NewPlayerController, const FUniqueNetIdRepl& UniqueId, const FString& Options, const FString& Portal)
|
||||
{
|
||||
FString ErrorMessage = Super::InitNewPlayer(NewPlayerController, UniqueId, Options, Portal);
|
||||
if (ErrorMessage != "")
|
||||
{
|
||||
return ErrorMessage;
|
||||
}
|
||||
|
||||
CharacterType Type = CharacterType(FCString::Atoi(*UGameplayStatics::ParseOption(Options, TEXT("CharacterType"))));
|
||||
TeamType Team = TeamType(FCString::Atoi(*UGameplayStatics::ParseOption(Options, TEXT("Team"))));
|
||||
|
||||
//DebugPerpose
|
||||
if (Type == CharacterType::Lukriel)
|
||||
{
|
||||
Type = CharacterType::Allium;
|
||||
}
|
||||
if (Team == TeamType::Null)
|
||||
{
|
||||
Team = TeamType::Black;
|
||||
}
|
||||
|
||||
if (ADefaultPlayerState* NewPlayerState = NewPlayerController->GetPlayerState<ADefaultPlayerState>())
|
||||
{
|
||||
NewPlayerState->SetCharacterBPRef(GetGameInstance<UDefaultGameInstance>()->GetCharacterBPRef(Type));
|
||||
//NewPlayerState->InitPlayerStats();
|
||||
NewPlayerState->SetTeam(Team);
|
||||
}
|
||||
|
||||
return ErrorMessage;
|
||||
}
|
||||
24
Source/Promether/GameModeBase/Deathmatch.h
Normal file
24
Source/Promether/GameModeBase/Deathmatch.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "Deathmatch.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API ADeathmatch : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ADeathmatch();
|
||||
|
||||
virtual void Tick(float DeltaSeconds) override;
|
||||
|
||||
virtual AActor* ChoosePlayerStart_Implementation(AController* Player) override;
|
||||
virtual APawn* SpawnDefaultPawnAtTransform_Implementation(AController* NewPlayer, const FTransform& SpawnTransform) override;
|
||||
|
||||
private:
|
||||
virtual FString InitNewPlayer(APlayerController* NewPlayerController, const FUniqueNetIdRepl& UniqueId, const FString& Options, const FString& Portal = TEXT("")) override;
|
||||
};
|
||||
35
Source/Promether/PlayerGeneric/DefaultAnimBPBase.cpp
Normal file
35
Source/Promether/PlayerGeneric/DefaultAnimBPBase.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "DefaultAnimBPBase.h"
|
||||
|
||||
#include "DefaultPlayerState.h"
|
||||
|
||||
UDefaultAnimBPBase::UDefaultAnimBPBase()
|
||||
{
|
||||
State = ECharacterState::Idle;
|
||||
}
|
||||
|
||||
void UDefaultAnimBPBase::NativeUpdateAnimation(float DeltaSeconds)
|
||||
{
|
||||
Super::NativeUpdateAnimation(DeltaSeconds);
|
||||
|
||||
if (APawn* MyPawn = TryGetPawnOwner())
|
||||
{
|
||||
if (ADefaultPlayerState* MyPlayerState = MyPawn->GetPlayerState<ADefaultPlayerState>())
|
||||
{
|
||||
State = MyPlayerState->GetState();
|
||||
AttackType = MyPlayerState->GetAttackType();
|
||||
|
||||
/*
|
||||
if (!GPlayInEditorID)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Server %s State : %d"), *MyPawn->GetName(), State);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Client %d %s State : %d"), GPlayInEditorID, *MyPawn->GetName(), State);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Source/Promether/PlayerGeneric/DefaultAnimBPBase.h
Normal file
25
Source/Promether/PlayerGeneric/DefaultAnimBPBase.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Animation/AnimInstance.h"
|
||||
#include "../PrometherEnum.h"
|
||||
#include "DefaultAnimBPBase.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API UDefaultAnimBPBase : public UAnimInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDefaultAnimBPBase();
|
||||
|
||||
virtual void NativeUpdateAnimation(float DeltaSeconds) override;
|
||||
|
||||
UPROPERTY(Transient, BlueprintReadWrite)
|
||||
ECharacterState State;
|
||||
|
||||
UPROPERTY(Transient, BlueprintReadWrite)
|
||||
CooldownType AttackType;
|
||||
};
|
||||
13
Source/Promether/PlayerGeneric/DefaultMovementRule.cpp
Normal file
13
Source/Promether/PlayerGeneric/DefaultMovementRule.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DefaultMovementRule.h"
|
||||
|
||||
UDefaultMovementRule::UDefaultMovementRule()
|
||||
{
|
||||
GroundFriction = 1000;
|
||||
MaxWalkSpeed = 400;
|
||||
MaxAcceleration = 2147483647;
|
||||
bOrientRotationToMovement = true;
|
||||
RotationRate = FRotator(0, 720, 0);
|
||||
}
|
||||
19
Source/Promether/PlayerGeneric/DefaultMovementRule.h
Normal file
19
Source/Promether/PlayerGeneric/DefaultMovementRule.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "DefaultMovementRule.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UDefaultMovementRule : public UCharacterMovementComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UDefaultMovementRule();
|
||||
};
|
||||
32
Source/Promether/PlayerGeneric/DefaultPlayerCamera.cpp
Normal file
32
Source/Promether/PlayerGeneric/DefaultPlayerCamera.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DefaultPlayerCamera.h"
|
||||
|
||||
ADefaultPlayerCamera::ADefaultPlayerCamera(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
bReplicates = true;
|
||||
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
CameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));
|
||||
CameraSpringArm->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 0.0f), FRotator(-45.0f, 0.0f, 0.0f));
|
||||
CameraSpringArm->SetAbsolute(false, true, true);
|
||||
CameraSpringArm->TargetArmLength = 1000.f;
|
||||
CameraSpringArm->bEnableCameraLag = true;
|
||||
CameraSpringArm->bDoCollisionTest = false;
|
||||
CameraSpringArm->CameraLagSpeed = 3.0f;
|
||||
SetRootComponent(CameraSpringArm);
|
||||
|
||||
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
||||
Camera->SetupAttachment(CameraSpringArm, USpringArmComponent::SocketName);
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void ADefaultPlayerCamera::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
||||
29
Source/Promether/PlayerGeneric/DefaultPlayerCamera.h
Normal file
29
Source/Promether/PlayerGeneric/DefaultPlayerCamera.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "DefaultPlayerCamera.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API ADefaultPlayerCamera : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ADefaultPlayerCamera(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere)
|
||||
USpringArmComponent* CameraSpringArm;
|
||||
UPROPERTY(EditAnywhere)
|
||||
UCameraComponent* Camera;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
};
|
||||
204
Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp
Normal file
204
Source/Promether/PlayerGeneric/DefaultPlayerCharacter.cpp
Normal file
@@ -0,0 +1,204 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DefaultPlayerCharacter.h"
|
||||
#include "DefaultPlayerState.h"
|
||||
#include "Engine/DamageEvents.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
ADefaultPlayerCharacter::ADefaultPlayerCharacter()
|
||||
{
|
||||
// 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);
|
||||
bUseControllerRotationYaw = false;
|
||||
|
||||
CameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));
|
||||
CameraSpringArm->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 0.0f), FRotator(-45.0f, 0.0f, 0.0f));
|
||||
CameraSpringArm->SetAbsolute(false, true, true);
|
||||
CameraSpringArm->TargetArmLength = 1000.f;
|
||||
CameraSpringArm->bEnableCameraLag = true;
|
||||
CameraSpringArm->bDoCollisionTest = false;
|
||||
CameraSpringArm->CameraLagSpeed = 3.0f;
|
||||
CameraSpringArm->SetupAttachment(RootComponent);
|
||||
|
||||
Camera = CreateDefaultSubobject<UCameraComponent>(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);
|
||||
}
|
||||
|
||||
void ADefaultPlayerCharacter::Tick(float DeltaTime)
|
||||
{
|
||||
/*
|
||||
if (GetPlayerState<ADefaultPlayerState>())
|
||||
{
|
||||
if (!GPlayInEditorID)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Server %s State : %d"), *GetName(), GetPlayerState<ADefaultPlayerState>()->GetState());
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Client %d %s State : %d"), GPlayInEditorID, *GetName(), GetPlayerState<ADefaultPlayerState>()->GetState());
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ADefaultPlayerCharacter::Attack_Implementation()
|
||||
{
|
||||
NetMulticast_Attack();
|
||||
}
|
||||
|
||||
void ADefaultPlayerCharacter::NetMulticast_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<ADefaultPlayerState>();
|
||||
if (!State) return ReturnValue;
|
||||
|
||||
if (!Cast<APawn>(DamageCauser)) return ReturnValue;
|
||||
|
||||
ADefaultPlayerState* AttackerState = Cast<APawn>(DamageCauser)->GetPlayerState<ADefaultPlayerState>();
|
||||
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<UBaseAttack>(DamageEvent.DamageTypeClass->GetDefaultObject()))
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("DamageType : BaseAttack"));
|
||||
|
||||
UpdatedHealth = State->Stats[(uint8)EStats::Health] - DamageAmount * ADDamageMultiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("DamageType : APDamage"));
|
||||
|
||||
UpdatedHealth = State->Stats[(uint8)EStats::Health] - DamageAmount * APDamageMultiplier;
|
||||
}
|
||||
|
||||
if (UpdatedHealth < 0 || UpdatedHealth < 0.1)
|
||||
{
|
||||
State->Stats[(uint8)EStats::Health] = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
State->Stats[(uint8)EStats::Health] = UpdatedHealth;
|
||||
}
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("Current Health : %f"), State->Stats[(uint8)EStats::Health]);
|
||||
UE_LOG(LogTemp, Warning, TEXT("U Health : %f"), UpdatedHealth);
|
||||
|
||||
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();
|
||||
}
|
||||
115
Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h
Normal file
115
Source/Promether/PlayerGeneric/DefaultPlayerCharacter.h
Normal file
@@ -0,0 +1,115 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
|
||||
#include "../PrometherEnum.h"
|
||||
#include "DefaultPlayerCharacter.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API ADefaultPlayerCharacter : public ACharacter
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
ADefaultPlayerCharacter();
|
||||
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Server, Reliable)
|
||||
void Attack();
|
||||
//Override me
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void BP_Attack();
|
||||
UFUNCTION(NetMulticast, Reliable)
|
||||
void NetMulticast_Attack();
|
||||
UFUNCTION(BlueprintNativeEvent)
|
||||
float TakeDamage( float Damage,
|
||||
struct FDamageEvent const& DamageEvent,
|
||||
AController* EventInstigator,
|
||||
AActor* DamageCauser ) override;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<EStats, float> DefaultStats;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
|
||||
TMap<CooldownType, float> CooldownDuration;
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere)
|
||||
USpringArmComponent* CameraSpringArm;
|
||||
UPROPERTY(EditAnywhere)
|
||||
UCameraComponent* Camera;
|
||||
};
|
||||
712
Source/Promether/PlayerGeneric/DefaultPlayerController.cpp
Normal file
712
Source/Promether/PlayerGeneric/DefaultPlayerController.cpp
Normal file
@@ -0,0 +1,712 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DefaultPlayerController.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "Blueprint/AIBlueprintHelperLibrary.h"
|
||||
#include "NavigationSystem.h"
|
||||
#include "Navigation/PathFollowingComponent.h"
|
||||
#include "AIController.h"
|
||||
|
||||
#include "DefaultPlayerState.h"
|
||||
#include "DefaultPlayerCamera.h"
|
||||
|
||||
|
||||
|
||||
void ADefaultPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player);
|
||||
if (!LocalPlayer) return;
|
||||
|
||||
UEnhancedInputLocalPlayerSubsystem* InputSystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>();
|
||||
if (!InputSystem) return;
|
||||
|
||||
if (PlayerInputMapping.IsNull())
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("AddMappingContext Failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
InputSystem->AddMappingContext(PlayerInputMapping.LoadSynchronous(), 0);
|
||||
this->bShowMouseCursor = true;
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::OnPossess(APawn* aPawn)
|
||||
{
|
||||
Super::OnPossess(aPawn);
|
||||
|
||||
Server_SpawnPlayerCamera();
|
||||
|
||||
AActor *PlayerCamera = GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera();
|
||||
if (!PlayerCamera)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("GetPlayerCamera Failed."));
|
||||
return;
|
||||
}
|
||||
|
||||
SetViewTarget(PlayerCamera);
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("SetViewTarget Success : %s"), *GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera()->GetName());
|
||||
|
||||
ADefaultPlayerCharacter* ControlledPawn = GetPawn<ADefaultPlayerCharacter>();
|
||||
if (!ControlledPawn) return;
|
||||
|
||||
ADefaultPlayerState* MyPlayerState = GetPlayerState<ADefaultPlayerState>();
|
||||
if (!MyPlayerState) return;
|
||||
|
||||
TArray<float> DefaultStatsValue;
|
||||
TArray<float> CooldownDurationValue;
|
||||
|
||||
ControlledPawn->DefaultStats.GenerateValueArray(DefaultStatsValue);
|
||||
ControlledPawn->CooldownDuration.GenerateValueArray(CooldownDurationValue);
|
||||
|
||||
MyPlayerState->InitPlayerStats(DefaultStatsValue, CooldownDurationValue);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::OnUnPossess()
|
||||
{
|
||||
Super::OnUnPossess();
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Server_SpawnPlayerCamera_Implementation()
|
||||
{
|
||||
AActor* OutContextPlayerCamera = nullptr;
|
||||
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
SpawnInfo.Instigator = GetInstigator();
|
||||
SpawnInfo.ObjectFlags |= RF_Transient;
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("SpawnPlayerCamera"));
|
||||
|
||||
APawn* MyPawn = GetPawn();
|
||||
if (!MyPawn) return;
|
||||
|
||||
FTransform SpawnTransform = FTransform();
|
||||
|
||||
SpawnTransform.SetLocation(MyPawn->GetActorLocation());
|
||||
|
||||
OutContextPlayerCamera = GetWorld()->SpawnActor<AActor>(ADefaultPlayerCamera::StaticClass(), SpawnTransform, SpawnInfo);
|
||||
if (!OutContextPlayerCamera)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Camera Spawn Failed."));
|
||||
return;
|
||||
}
|
||||
|
||||
GetPlayerState<ADefaultPlayerState>()->SetPlayerCamera(OutContextPlayerCamera);
|
||||
OutContextPlayerCamera->AttachToActor(GetPawn(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, false));
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("SetPlayerCamera Success : %s, %d"), *GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera()->GetName(), GetPlayerState<ADefaultPlayerState>()->GetPlayerCamera());
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::SetACharacterOutlineColor(ACharacter* Target, bool Visible)
|
||||
{
|
||||
if (HasAuthority()) return;
|
||||
|
||||
ADefaultPlayerState* State = Target->GetPlayerState<ADefaultPlayerState>();
|
||||
if (!State)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("GetPlayerState<ADefaultPlayerState> Failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (State->GetTeam() == GetPlayerState<ADefaultPlayerState>()->GetTeam())
|
||||
{
|
||||
Target->GetMesh()->SetRenderCustomDepth(Visible);
|
||||
Target->GetMesh()->CustomDepthStencilValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Target->GetMesh()->SetRenderCustomDepth(Visible);
|
||||
Target->GetMesh()->CustomDepthStencilValue = 2;
|
||||
}
|
||||
}
|
||||
|
||||
ADefaultPlayerController::ADefaultPlayerController()
|
||||
{
|
||||
MouseClickInterval = 0.2;
|
||||
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
AutoManageActiveCameraTarget(false);
|
||||
|
||||
DefaultMouseCursor = EMouseCursor::Crosshairs;
|
||||
|
||||
static ConstructorHelpers::FObjectFinder<UInputMappingContext>
|
||||
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<UInputAction>
|
||||
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()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
|
||||
UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(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<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] == 1)
|
||||
return;
|
||||
if (!(GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] >= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill1Cost]))
|
||||
return;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] -= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill1Cost];
|
||||
EndAttack();
|
||||
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Attackable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill1);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Skill2()
|
||||
{
|
||||
if (GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] == 1)
|
||||
return;
|
||||
if (!(GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] >= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill2Cost]))
|
||||
return;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] -= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill2Cost];
|
||||
|
||||
EndAttack();
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Attackable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill2);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Skill3()
|
||||
{
|
||||
if (GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] == 1)
|
||||
return;
|
||||
if (!(GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] >= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill3Cost]))
|
||||
return;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] -= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill3Cost];
|
||||
EndAttack();
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Attackable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill3);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Skill4Triggered()
|
||||
{//<2F><>Ÿ<EFBFBD><C5B8> üũ <20>ֱ<EFBFBD>
|
||||
|
||||
if (!GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::charging] == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true<75><65> <20>ƴ<EFBFBD> <20><>
|
||||
{
|
||||
if (!GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] == 0) {
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Idle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] >= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill4Cost])) {
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Idle);
|
||||
return;
|
||||
}
|
||||
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Mana] -= GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skill4Cost];
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::charging] = 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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill4Triggered);
|
||||
|
||||
}
|
||||
|
||||
if (GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::charging] == 0) {
|
||||
EndAttack();
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Attackable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Skillusable] = 1;
|
||||
GetPlayerState<ADefaultPlayerState>()->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<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill4Triggered);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Skill4Completed()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Skill4 Completed"));
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Skill4Comlpleted);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::RuneSpell1()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("RuneSpell1"));
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::RuneSpell1);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::RuneSpell2()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("RuneSpell2"));
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::RuneSpell2);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Ward()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Ward"));
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Ward);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Bomb()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Bomb"));
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Bomb);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::ObjectSelect()
|
||||
{
|
||||
FHitResult HitResult;
|
||||
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
|
||||
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_WorldStatic));
|
||||
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn));
|
||||
|
||||
GetHitResultUnderCursorForObjects(ObjectTypes, true, HitResult);
|
||||
|
||||
ACharacter* HitObject = Cast<ACharacter>(HitResult.GetActor());
|
||||
if (!HitObject) return;
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("%s"), *HitObject->GetName());
|
||||
SetACharacterOutlineColor(HitObject, true);
|
||||
}
|
||||
|
||||
|
||||
void ADefaultPlayerController::Move()
|
||||
{
|
||||
EndAttack();
|
||||
FHitResult HitResult;
|
||||
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
|
||||
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_WorldStatic));
|
||||
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn));
|
||||
|
||||
GetHitResultUnderCursorForObjects(ObjectTypes, true, HitResult);
|
||||
ACharacter* HitCharacter = Cast<ACharacter>(HitResult.GetActor()); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HitCharactor<6F><72> <20><><EFBFBD><EFBFBD><<<3C><><EFBFBD><EFBFBD> <20><> ij<><C4B3><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD>
|
||||
HitTarget = HitResult.GetActor();
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("%s"), *HitResult.GetActor()->GetName());
|
||||
|
||||
if (HitResult.GetActor() != GetPawn<AActor>()) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HitObject<63><74> null<6C><6C> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD> Attack()<29><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>, HitObject<63><74> <20><> ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD>
|
||||
{
|
||||
if (GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Attackable] == 1)
|
||||
return;
|
||||
if (!HitCharacter)
|
||||
{
|
||||
FVector Destination = GetMouseHitLocation();
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
|
||||
SimpleMoveToLocation(this, Destination);
|
||||
this->MoveToLocation(Destination);
|
||||
return;
|
||||
}
|
||||
BeginAttack(); //HitObject<63><74> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BeginAttack <20><><EFBFBD><EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Movable] == 0)
|
||||
return;
|
||||
FVector Destination = GetMouseHitLocation();
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
|
||||
SimpleMoveToLocation(this, Destination);
|
||||
this->MoveToLocation(Destination);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::Multicast_SetRotation_Implementation(FVector MouseHitLocation)
|
||||
{
|
||||
FVector Location = GetPawn()->GetActorLocation();
|
||||
Location.Z = 0;
|
||||
|
||||
FRotator NewRotation = (MouseHitLocation - Location).Rotation();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> X<><58><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ʹٸ<CDB4> <20>Ʒ<EFBFBD><C6B7><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ش<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
|
||||
|
||||
NewRotation.Pitch = 0;
|
||||
|
||||
GetPawn()->SetActorRotation(NewRotation);
|
||||
|
||||
}
|
||||
|
||||
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<UPathFollowingComponent>();
|
||||
if (!PFollowComp) return;
|
||||
|
||||
PFollowComp->OnRequestFinished.Clear();
|
||||
|
||||
PFollowComp->RequestMoveWithImmediateFinish(EPathFollowingResult::Success);
|
||||
|
||||
PFollowComp->OnRequestFinished.AddUObject(this, &ADefaultPlayerController::OnMoveCompleted);
|
||||
}
|
||||
|
||||
FVector ADefaultPlayerController::GetMouseHitLocation()
|
||||
{
|
||||
FHitResult HitResult;
|
||||
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);
|
||||
|
||||
FVector ActorLocation = GetPawn()->GetActorLocation();
|
||||
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);
|
||||
DrawDebugLine(GetWorld(), HitResult.Location, Destination, FColor::Emerald, false, 1, 0, 1);
|
||||
|
||||
const UWorld* CurrentWorld = GetWorld();
|
||||
if (!CurrentWorld) return Destination;
|
||||
|
||||
FHitResult CollisionCheck;
|
||||
|
||||
FCollisionQueryParams CollisionParams;
|
||||
CollisionParams.AddIgnoredActor(GetPawn());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::SimpleMoveToLocation(AController* Controller, const FVector& GoalLocation)
|
||||
{
|
||||
UNavigationSystemV1* NavSys = Controller ? FNavigationSystem::GetCurrent<UNavigationSystemV1>(Controller->GetWorld()) : nullptr;
|
||||
if (NavSys == nullptr || Controller == nullptr || Controller->GetPawn() == nullptr)
|
||||
{
|
||||
UE_LOG(LogNavigation, Warning, TEXT("UNavigationSystemV1::SimpleMoveToActor called for NavSys:%s Controller:%s controlling Pawn:%s (if any of these is None then there's your problem"),
|
||||
*GetNameSafe(NavSys), *GetNameSafe(Controller), Controller ? *GetNameSafe(Controller->GetPawn()) : TEXT("NULL"));
|
||||
return;
|
||||
}
|
||||
|
||||
AAIController* AsAIController = Cast<AAIController>(Controller);
|
||||
UPathFollowingComponent* PFollowComp = nullptr;
|
||||
|
||||
if (AsAIController)
|
||||
{
|
||||
PFollowComp = AsAIController->GetPathFollowingComponent();
|
||||
}
|
||||
else
|
||||
{
|
||||
PFollowComp = Controller->FindComponentByClass<UPathFollowingComponent>();
|
||||
if (PFollowComp == nullptr)
|
||||
{
|
||||
PFollowComp = NewObject<UPathFollowingComponent>(Controller);
|
||||
PFollowComp->RegisterComponentWithWorld(Controller->GetWorld());
|
||||
PFollowComp->Initialize();
|
||||
PFollowComp->OnRequestFinished.AddUObject(this, &ADefaultPlayerController::OnMoveCompleted);
|
||||
}
|
||||
}
|
||||
|
||||
if (PFollowComp == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PFollowComp->IsPathFollowingAllowed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bAlreadyAtGoal = PFollowComp->HasReached(GoalLocation, EPathFollowingReachMode::OverlapAgent);
|
||||
|
||||
// script source, keep only one move request at time
|
||||
if (PFollowComp->GetStatus() != EPathFollowingStatus::Idle)
|
||||
{
|
||||
PFollowComp->AbortMove(*NavSys, FPathFollowingResultFlags::ForcedScript | FPathFollowingResultFlags::NewRequest
|
||||
, FAIRequestID::AnyRequest, bAlreadyAtGoal ? EPathFollowingVelocityMode::Reset : EPathFollowingVelocityMode::Keep);
|
||||
}
|
||||
|
||||
// script source, keep only one move request at time
|
||||
if (PFollowComp->GetStatus() != EPathFollowingStatus::Idle)
|
||||
{
|
||||
PFollowComp->AbortMove(*NavSys, FPathFollowingResultFlags::ForcedScript | FPathFollowingResultFlags::NewRequest);
|
||||
}
|
||||
|
||||
if (bAlreadyAtGoal)
|
||||
{
|
||||
PFollowComp->RequestMoveWithImmediateFinish(EPathFollowingResult::Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
const FVector AgentNavLocation = Controller->GetNavAgentLocation();
|
||||
const ANavigationData* NavData = NavSys->GetNavDataForProps(Controller->GetNavAgentPropertiesRef(), AgentNavLocation);
|
||||
if (NavData)
|
||||
{
|
||||
FPathFindingQuery Query(Controller, *NavData, AgentNavLocation, GoalLocation);
|
||||
FPathFindingResult Result = NavSys->FindPathSync(Query);
|
||||
if (Result.IsSuccessful())
|
||||
{
|
||||
PFollowComp->RequestMove(FAIMoveRequest(GoalLocation), Result.Path);
|
||||
}
|
||||
else if (PFollowComp->GetStatus() != EPathFollowingStatus::Idle)
|
||||
{
|
||||
PFollowComp->RequestMoveWithImmediateFinish(EPathFollowingResult::Invalid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& MovementResult)
|
||||
{
|
||||
if (!MovementResult.IsSuccess()) return;
|
||||
|
||||
if (!GPlayInEditorID)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Server MoveCompleted"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Client%d MoveCompleted"), GPlayInEditorID);
|
||||
}
|
||||
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Idle);
|
||||
}
|
||||
|
||||
FTimerHandle TimerHandle;
|
||||
|
||||
void ADefaultPlayerController::BeginAttack()
|
||||
{
|
||||
GetWorldTimerManager().SetTimer(TimerHandle, this, &ADefaultPlayerController::RepeatedAttack, 0.1f, true);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::EndAttack()
|
||||
{
|
||||
|
||||
GetWorldTimerManager().ClearTimer(TimerHandle);
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::RepeatedAttack()
|
||||
{
|
||||
if (!GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats::Attackable] == 0)
|
||||
return;
|
||||
Attack();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ADefaultPlayerController::Attack()
|
||||
{
|
||||
|
||||
float MinDistance = GetPlayerState<ADefaultPlayerState>()->Stats[(uint8)EStats:: AttackRange];
|
||||
FVector Destination = HitTarget->GetActorLocation(); // HitObject<63><74> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
if (FVector::Dist(Destination, GetPawn()->GetActorLocation()) <= MinDistance)
|
||||
{
|
||||
if ((GetPlayerState<ADefaultPlayerState>()->CooldownDuration[(uint8)CooldownType::Attack] != 0))
|
||||
return;
|
||||
|
||||
|
||||
FVector Location = GetPawn()->GetActorLocation();
|
||||
Location.X = 0;
|
||||
|
||||
Server_StopMove();
|
||||
Multicast_StopMove();
|
||||
|
||||
Multicast_SetRotation(Destination);
|
||||
Server_SetRotation(Destination);
|
||||
|
||||
|
||||
UE_LOG(LogTemp, Warning, TEXT("Attack"));
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Attack);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
|
||||
SimpleMoveToLocation(this, Destination);
|
||||
|
||||
|
||||
|
||||
this->MoveToLocation(Destination);
|
||||
}
|
||||
SetTarget();
|
||||
}
|
||||
|
||||
void ADefaultPlayerController::MoveToLocation_Implementation(FVector Location)
|
||||
{
|
||||
SimpleMoveToLocation(this, Location);
|
||||
}
|
||||
108
Source/Promether/PlayerGeneric/DefaultPlayerController.h
Normal file
108
Source/Promether/PlayerGeneric/DefaultPlayerController.h
Normal file
@@ -0,0 +1,108 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "InputMappingContext.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
#include "AIController.h"
|
||||
#include "DefaultPlayerController.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API ADefaultPlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
virtual void OnPossess(APawn* aPawn) override;
|
||||
virtual void OnUnPossess() override;
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void Server_SpawnPlayerCamera();
|
||||
|
||||
void SetACharacterOutlineColor(ACharacter* Target, bool Visible);
|
||||
|
||||
public:
|
||||
ADefaultPlayerController();
|
||||
|
||||
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();
|
||||
void Bomb();
|
||||
void ObjectSelect();
|
||||
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")
|
||||
void SimpleMoveToLocation(AController* Controller, const FVector& Goal);
|
||||
|
||||
void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult &MovementResult);
|
||||
|
||||
void BeginAttack();
|
||||
void EndAttack();
|
||||
void RepeatedAttack();
|
||||
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void SetTarget();
|
||||
|
||||
void Attack();
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float MouseClickInterval;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "My Actor")
|
||||
AActor* HitTarget;
|
||||
|
||||
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputMappingContext> PlayerInputMapping;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> Skill1Action;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> Skill2Action;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> Skill3Action;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> Skill4Action;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> RuneSpell1Action;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> RuneSpell2Action;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> WardAction;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> BombAction;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> ObjectSelectAction;
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TSoftObjectPtr<UInputAction> MoveAction;
|
||||
};
|
||||
66
Source/Promether/PlayerGeneric/DefaultPlayerState.cpp
Normal file
66
Source/Promether/PlayerGeneric/DefaultPlayerState.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "DefaultPlayerState.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
|
||||
ADefaultPlayerState::ADefaultPlayerState()
|
||||
{
|
||||
CharacterBPRef = nullptr;;
|
||||
Team = TeamType::Null;
|
||||
State = ECharacterState::Idle;
|
||||
}
|
||||
|
||||
void ADefaultPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
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, StatusEffectObject);
|
||||
DOREPLIFETIME(ADefaultPlayerState, PlayerCamera);
|
||||
}
|
||||
|
||||
void ADefaultPlayerState::InitPlayerStats_Implementation(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue)
|
||||
{
|
||||
MaxStats.Append(StatsValue);
|
||||
Stats.Append(StatsValue);
|
||||
CooldownDuration.Append(CooldownDurationValue);
|
||||
MaxCooldownDuration.Append(CooldownDurationValue);
|
||||
|
||||
|
||||
for (float Value : StatsValue)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Values: %f"), Value);
|
||||
}
|
||||
}
|
||||
|
||||
void ADefaultPlayerState::NetMulticast_SetAttackType_Implementation(CooldownType Value)
|
||||
{
|
||||
AttackType = Value;
|
||||
}
|
||||
|
||||
void ADefaultPlayerState::NetMulticast_SetState_Implementation(ECharacterState Value)
|
||||
{
|
||||
State = Value;
|
||||
}
|
||||
|
||||
void ADefaultPlayerState::SetState_Implementation(ECharacterState Value)
|
||||
{
|
||||
NetMulticast_SetState(Value);
|
||||
}
|
||||
|
||||
void ADefaultPlayerState::SetAttackType_Implementation(CooldownType Value)
|
||||
{
|
||||
NetMulticast_SetAttackType(Value);
|
||||
}
|
||||
|
||||
int32 ADefaultPlayerState::GetCharacterLevel() const
|
||||
{
|
||||
return int32();
|
||||
}
|
||||
92
Source/Promether/PlayerGeneric/DefaultPlayerState.h
Normal file
92
Source/Promether/PlayerGeneric/DefaultPlayerState.h
Normal file
@@ -0,0 +1,92 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
#include "../PrometherEnum.h"
|
||||
#include "DefaultPlayerCharacter.h"
|
||||
#include "../StatusEffect/StatusEffect.h"
|
||||
#include "DefaultPlayerState.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class PROMETHER_API ADefaultPlayerState : public APlayerState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ADefaultPlayerState();
|
||||
void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override;
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void InitPlayerStats(const TArray<float>& StatsValue, const TArray<float>& CooldownDurationValue);
|
||||
|
||||
void SetCharacterBPRef(UClass* Value) { CharacterBPRef = Value; }
|
||||
UClass* GetCharacterBPRef() const { return CharacterBPRef; }
|
||||
|
||||
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetTeam(TeamType Value) { Team = Value; }
|
||||
UFUNCTION(BlueprintCallable)
|
||||
TeamType GetTeam() const { return Team; }
|
||||
|
||||
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;
|
||||
|
||||
UPROPERTY(Replicated, Transient, EditAnywhere, BlueprintReadWrite)
|
||||
TArray<float> Stats;
|
||||
UPROPERTY(Replicated, Transient, EditAnywhere, BlueprintReadWrite)
|
||||
TArray<float> MaxStats;
|
||||
|
||||
UPROPERTY(Replicated, Transient, BlueprintReadWrite)
|
||||
TArray<float> CooldownDuration;
|
||||
UPROPERTY(Replicated, Transient, BlueprintReadWrite)
|
||||
TArray<float> MaxCooldownDuration;
|
||||
|
||||
private:
|
||||
UPROPERTY(Replicated, Transient)
|
||||
UClass* CharacterBPRef;
|
||||
UPROPERTY(Replicated, Transient)
|
||||
TeamType Team;
|
||||
|
||||
UPROPERTY(Replicated, Transient)
|
||||
ECharacterState State;
|
||||
UPROPERTY(Replicated, Transient)
|
||||
CooldownType AttackType;
|
||||
|
||||
//UPROPERTY(Replicated, Transient)
|
||||
//TMap<FUniqueObjectID, UStatusEffect> StatusEffectObject;
|
||||
|
||||
UPROPERTY(Replicated, Transient)
|
||||
AActor* PlayerCamera;
|
||||
};
|
||||
5
Source/Promether/Private/DamageType/ApDamage.cpp
Normal file
5
Source/Promether/Private/DamageType/ApDamage.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DamageType/ApDamage.h"
|
||||
|
||||
23
Source/Promether/Promether.Build.cs
Normal file
23
Source/Promether/Promether.Build.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class Promether : ModuleRules
|
||||
{
|
||||
public Promether(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "AIModule", "NavigationSystem", "OnlineSubsystem" });
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
||||
// Uncomment if you are using Slate UI
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
|
||||
// Uncomment if you are using online features
|
||||
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
||||
|
||||
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
||||
}
|
||||
}
|
||||
6
Source/Promether/Promether.cpp
Normal file
6
Source/Promether/Promether.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "Promether.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, Promether, "Promether" );
|
||||
6
Source/Promether/Promether.h
Normal file
6
Source/Promether/Promether.h
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
153
Source/Promether/PrometherEnum.h
Normal file
153
Source/Promether/PrometherEnum.h
Normal file
@@ -0,0 +1,153 @@
|
||||
#pragma once
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "DamageType/BaseAttack.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class CharacterType : uint8
|
||||
{
|
||||
Lukriel,
|
||||
Allium,
|
||||
Riana,
|
||||
Lb,
|
||||
SIZE
|
||||
};
|
||||
|
||||
/*UENUM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (const UEnum* CharStateEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("CharacterType"), true))
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("%s"), *CharStateEnum->GetNameByValue((uint8)Type).ToString());
|
||||
}
|
||||
*/
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class TeamType : uint8
|
||||
{
|
||||
Null,
|
||||
Neutral,
|
||||
Black,
|
||||
White
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class CooldownType : uint8
|
||||
{
|
||||
Skill1,
|
||||
Skill2,
|
||||
Skill3,
|
||||
Skill4Started,
|
||||
Skill4Triggered,
|
||||
Skill4Comlpleted,
|
||||
RuneSpell1,
|
||||
RuneSpell2,
|
||||
Ward,
|
||||
Bomb,
|
||||
Move,
|
||||
Attack,
|
||||
SIZE
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum class CCType : uint32
|
||||
{
|
||||
None = 0x00000000,
|
||||
Slow = 0x00000001,
|
||||
Cripple = 0x00000002,
|
||||
Silence = 0x00000004,
|
||||
Blind = 0x00000008,
|
||||
BlockedSight = 0x00000010,
|
||||
Grounding = 0x00000020,
|
||||
Polymorph = 0x00000040,
|
||||
Disarmed = 0x00000080,
|
||||
Kinematic = 0x00000100,
|
||||
Knockdown = 0x00000200,
|
||||
Root = 0x00000400,
|
||||
Stun = 0x00000800,
|
||||
Airbone = 0x00001000,
|
||||
Knockback = 0x00002000,
|
||||
Grab = 0x00004000,
|
||||
Suspension = 0x00008000,
|
||||
Taunt = 0x00010000,
|
||||
Charm = 0x00020000,
|
||||
Flee = 0x00040000,
|
||||
Suppressed = 0x00080000,
|
||||
Banishment = 0x00100000,
|
||||
Sleep = 0x00200000
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ECharacterState : uint8
|
||||
{
|
||||
Idle,
|
||||
Moving,
|
||||
Attack,
|
||||
Dead,
|
||||
SIZE
|
||||
};
|
||||
|
||||
struct FUniqueObjectID
|
||||
{
|
||||
double ConstructTime;
|
||||
int32 RandomUniqueNumber;
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EStats : uint8
|
||||
{
|
||||
currentExp,
|
||||
MaxExp,
|
||||
Level,
|
||||
Health,
|
||||
HPRegeneration,
|
||||
HealAndShieldpower,
|
||||
Armor,
|
||||
MaxHealth,
|
||||
MagicResistance,
|
||||
MaxMana,
|
||||
Tenacity,
|
||||
SlowRisist,
|
||||
AttackSpeed,
|
||||
AttackSpeedBuff,
|
||||
AttackDamage,
|
||||
AttackDamageBuff,
|
||||
AbilityPower,
|
||||
AbilityPowerBuff,
|
||||
CriticalStrikeChance,
|
||||
CriticalStrikeDamage,
|
||||
ArmorPenetration,
|
||||
MagicPenetration,
|
||||
LifeSteal,
|
||||
PhysicalVamp,
|
||||
Omnivamp,
|
||||
AbilityHaste,
|
||||
Mana,
|
||||
ManaRegeneration,
|
||||
Energy,
|
||||
EnergyRegeneration,
|
||||
AttackRange,
|
||||
MovementSpeed,
|
||||
MovementSpeedBuff,
|
||||
GoldGeneration,
|
||||
AttackDamageGrowth,
|
||||
AttackSpeedGrowth,
|
||||
ArmorGrowth,
|
||||
MagicResistanceGrowth,
|
||||
HealthGrowth,
|
||||
HealthRegenerationGrowth,
|
||||
ManaGrowth,
|
||||
ManaRegenerationGrowth,
|
||||
Movable,
|
||||
Skillusable,
|
||||
Attackable,
|
||||
charging,
|
||||
Skill1Cost,
|
||||
Skill2Cost,
|
||||
Skill3Cost,
|
||||
Skill4Cost,
|
||||
Skill1Level,
|
||||
Skill2Level,
|
||||
Skill3Level,
|
||||
Skill4Level,
|
||||
SIZE,
|
||||
};
|
||||
17
Source/Promether/Public/DamageType/ApDamage.h
Normal file
17
Source/Promether/Public/DamageType/ApDamage.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/DamageType.h"
|
||||
#include "ApDamage.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UApDamage : public UDamageType
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
5
Source/Promether/StatusEffect/StatusEffect.cpp
Normal file
5
Source/Promether/StatusEffect/StatusEffect.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "StatusEffect.h"
|
||||
|
||||
19
Source/Promether/StatusEffect/StatusEffect.h
Normal file
19
Source/Promether/StatusEffect/StatusEffect.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "StatusEffect.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROMETHER_API UStatusEffect : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
15
Source/PrometherEditor.Target.cs
Normal file
15
Source/PrometherEditor.Target.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PrometherEditorTarget : TargetRules
|
||||
{
|
||||
public PrometherEditorTarget( TargetInfo Target) : base(Target)
|
||||
{
|
||||
Type = TargetType.Editor;
|
||||
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||
ExtraModuleNames.Add("Promether");
|
||||
}
|
||||
}
|
||||
15
Source/PrometherServer.Target.cs
Normal file
15
Source/PrometherServer.Target.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PrometherServerTarget : TargetRules
|
||||
{
|
||||
public PrometherServerTarget(TargetInfo Target) : base(Target)
|
||||
{
|
||||
Type = TargetType.Server;
|
||||
DefaultBuildSettings = BuildSettingsVersion.V2;
|
||||
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;
|
||||
ExtraModuleNames.Add("Promether");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user