added different troopers, made camera spectate, changed floor material, made some other small changes + clang-format

pull/5/head
m4xxx1m 2 years ago
parent 985612b4de
commit 114f9b28e1

@ -5,152 +5,159 @@
#include "MyPawn.h"
#include "MyGameState.h"
AMyGameMode::AMyGameMode() : Super()
{
AMyGameMode::AMyGameMode()
: Super() {
UE_LOG(LogTemp, Warning, TEXT("GameMode Constructor"));
GameStateClass = AMyGameState::StaticClass();
PlayerControllerClass = AMyPlayerController::StaticClass();
DefaultPawnClass = AMyPawn::StaticClass();
}
void AMyGameMode::BeginPlay()
{
void AMyGameMode::BeginPlay() {
Super::BeginPlay();
}
void AMyGameMode::InitializeBattleField() const
{
void AMyGameMode::InitializeBattleField() const {
UE_LOG(LogTemp, Warning, TEXT("InitializeBattleField"));
FVector Location(2000.0f, -1000.0f, 0.0f);
FRotator Rotation(0.0f, 180.0f, 0.0f);
uint8 TrooperCount = 0;
for (int i = 0; i < 5; ++i)
{
TArray<const TCHAR *> bpPaths{
TEXT(
"Blueprint'/Game/Troopers/TrooperSkeletonMelee.TrooperSkeletonMelee_C'"
),
TEXT("Blueprint'/Game/Troopers/TrooperWizard.TrooperWizard_C'")
};
TArray<UClass *> LoadedBpAssets;
for (int i = 0; i < bpPaths.Num(); ++i) {
TSoftClassPtr<ATrooper> ActorBpClass = TSoftClassPtr<ATrooper>(
FSoftObjectPath(bpPaths[i])
);
LoadedBpAssets.Push(ActorBpClass.LoadSynchronous());
}
for (int i = 0; i < 5; ++i) {
FTransform SpawnLocationAndRotation(Rotation);
SpawnLocationAndRotation.SetLocation(Location);
AActor* Spawned = GetWorld()->SpawnActorDeferred<ATrooper>(ATrooper::StaticClass(), SpawnLocationAndRotation);
dynamic_cast<ATrooper*>(Spawned)->Initialize(0, Location, TrooperCount++);
AActor *Spawned = GetWorld()->SpawnActorDeferred<ATrooper>(
LoadedBpAssets[i % 2], SpawnLocationAndRotation);
dynamic_cast<ATrooper *>(Spawned)->Initialize(
0, Location, TrooperCount++);
Spawned->FinishSpawning(SpawnLocationAndRotation);
Spawned->SetActorLocation(Location);
Location += {0.f, 500.f, 0.0f};
}
Location = {-2000.0f, -1000.0f, 0.0f};
Rotation = {0.0f, 0.0f, 0.0f};
for (int i = 0; i < 5; ++i)
{
for (int i = 0; i < 5; ++i) {
FTransform SpawnLocationAndRotation(Rotation);
SpawnLocationAndRotation.SetLocation(Location);
AActor* Spawned = GetWorld()->SpawnActorDeferred<ATrooper>(ATrooper::StaticClass(), SpawnLocationAndRotation);
dynamic_cast<ATrooper*>(Spawned)->Initialize(1, Location, TrooperCount++);
AActor *Spawned = GetWorld()->SpawnActorDeferred<ATrooper>(
LoadedBpAssets[i % 2], SpawnLocationAndRotation);
dynamic_cast<ATrooper *>(Spawned)->Initialize(
1, Location, TrooperCount++);
Spawned->FinishSpawning(SpawnLocationAndRotation);
Spawned->SetActorLocation(Location);
Location += {0.f, 500.f, 0.0f};
}
}
AActor* AMyGameMode::ChoosePlayerStart_Implementation(AController* Player)
{
UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart %d"), GetNumPlayers());
AActor *AMyGameMode::ChoosePlayerStart_Implementation(AController *Player) {
UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart %d"),
GetNumPlayers());
InitializeSpawnPointsIfNeeded(Player);
const auto CurrentPlayerStart = *SpawnPoints.Find(GetNumPlayers());
UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart end %d"), CurrentPlayerStart->GetPlayerIndex());
UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart end %d"),
CurrentPlayerStart->GetPlayerIndex());
return CurrentPlayerStart;
}
void AMyGameMode::InitializeSpawnPointsIfNeeded(AController* Player)
{
void AMyGameMode::InitializeSpawnPointsIfNeeded(AController *Player) {
UE_LOG(LogTemp, Warning, TEXT("InitializeSpawnPointsIfNeeded"));
if (SpawnPoints.Num() != 0)
{
UE_LOG(LogTemp, Warning, TEXT("InitializeSpawnPointsIfNeeded Exit %d"), SpawnPoints.Num());
if (SpawnPoints.Num() != 0) {
UE_LOG(LogTemp, Warning, TEXT("InitializeSpawnPointsIfNeeded Exit %d"),
SpawnPoints.Num());
return;
}
UE_LOG(LogTemp, Warning, TEXT("Rebuilding spawnpoints"));
const auto World = GetWorld();
for (TActorIterator<AMyPlayerStart> PlayerStartIterator(GetWorld()); PlayerStartIterator; ++PlayerStartIterator)
{
for (TActorIterator<AMyPlayerStart> PlayerStartIterator(GetWorld());
PlayerStartIterator; ++PlayerStartIterator) {
const auto PlayerStart = *PlayerStartIterator;
const UClass* PawnClass = GetDefaultPawnClassForController(Player);
const APawn* PawnToFit = PawnClass ? PawnClass->GetDefaultObject<APawn>() : nullptr;
const UClass *PawnClass = GetDefaultPawnClassForController(Player);
const APawn *PawnToFit = PawnClass
? PawnClass->GetDefaultObject<APawn>()
: nullptr;
const FVector ActorLocation = PlayerStart->GetActorLocation();
const FRotator ActorRotation = PlayerStart->GetActorRotation();
UE_LOG(LogTemp, Warning, TEXT("PlayerStart iterator %d"), PlayerStartIterator->GetPlayerIndex());
if (!World->EncroachingBlockingGeometry(PawnToFit, ActorLocation, ActorRotation))
{
SpawnPoints.Add(PlayerStartIterator->GetPlayerIndex(), *PlayerStartIterator);
UE_LOG(LogTemp, Warning, TEXT("PlayerStart unoccupied iterator %d"), PlayerStartIterator->GetPlayerIndex());
UE_LOG(LogTemp, Warning, TEXT("PlayerStart iterator %d"),
PlayerStartIterator->GetPlayerIndex());
if (!World->EncroachingBlockingGeometry(PawnToFit, ActorLocation,
ActorRotation)) {
SpawnPoints.Add(PlayerStartIterator->GetPlayerIndex(),
*PlayerStartIterator);
UE_LOG(LogTemp, Warning, TEXT("PlayerStart unoccupied iterator %d"),
PlayerStartIterator->GetPlayerIndex());
}
}
}
void AMyGameMode::PostLogin(APlayerController* NewPlayer)
{
void AMyGameMode::PostLogin(APlayerController *NewPlayer) {
Super::PostLogin(NewPlayer);
UE_LOG(LogTemp, Warning, TEXT("PostLogin"));
const auto World = GetWorld();
// const auto World = GetWorld();
const auto CurrentNumberOfPlayers = GetNumPlayers();
// 0-indexation
dynamic_cast<AMyPlayerController*>(NewPlayer)->SetPlayerIndex(CurrentNumberOfPlayers - 1);
dynamic_cast<AMyPlayerController *>(NewPlayer)->SetPlayerIndex(
CurrentNumberOfPlayers - 1);
UE_LOG(LogTemp, Warning, TEXT("%d"), CurrentNumberOfPlayers);
if (CurrentNumberOfPlayers == 2)
{
if (CurrentNumberOfPlayers == 2) {
UE_LOG(LogTemp, Warning, TEXT("Game Start"));
// start the game
StartGame();
}
else
{
} else {
// delay the game
UE_LOG(LogTemp, Warning, TEXT("Game Delay"));
}
}
void AMyGameMode::StartGame()
{
void AMyGameMode::StartGame() {
InitializeBattleField();
PlayerInTurn()->StartTurn();
}
AMyPlayerController* AMyGameMode::PlayerInTurn() const
{
AMyPlayerController *AMyGameMode::PlayerInTurn() const {
return GetMyPlayerController(CurrentPlayerTurn);
}
AMyPlayerController* AMyGameMode::PlayerNotInTurn() const
{
uint8 PlayerControllerIndexNotInTurn = 0;
if (CurrentPlayerTurn == 0)
{
AMyPlayerController *AMyGameMode::PlayerNotInTurn() const {
uint8 PlayerControllerIndexNotInTurn;
if (CurrentPlayerTurn == 0) {
PlayerControllerIndexNotInTurn = 1;
}
else
{
} else {
PlayerControllerIndexNotInTurn = 0;
}
return GetMyPlayerController(PlayerControllerIndexNotInTurn);
}
void AMyGameMode::CycleTurns()
{
void AMyGameMode::CycleTurns() {
PlayerInTurn()->EndTurn();
if (CurrentPlayerTurn == 0)
{
if (CurrentPlayerTurn == 0) {
CurrentPlayerTurn = 1;
}
else
{
} else {
CurrentPlayerTurn = 0;
}
PlayerInTurn()->StartTurn();
}
AMyPlayerController* AMyGameMode::GetMyPlayerController(uint8 const PlayerIndex) const
{
return dynamic_cast<AMyPlayerController*>(UGameplayStatics::GetPlayerController(GetWorld(), PlayerIndex));
AMyPlayerController *AMyGameMode::GetMyPlayerController(
uint8 const PlayerIndex) const {
return dynamic_cast<AMyPlayerController *>(
UGameplayStatics::GetPlayerController(GetWorld(), PlayerIndex));
}

@ -9,18 +9,17 @@
#include "GameFramework/GameMode.h"
#include "MyGameMode.generated.h"
UCLASS()
class TURNBASEDTUTORIAL_API AMyGameMode : public AGameMode
{
class TURNBASEDTUTORIAL_API AMyGameMode : public AGameMode {
GENERATED_BODY()
public:
AMyGameMode();
virtual AActor* ChoosePlayerStart_Implementation(AController* Player) override;
virtual AActor *
ChoosePlayerStart_Implementation(AController *Player) override;
virtual void PostLogin(APlayerController* NewPlayer) override;
virtual void PostLogin(APlayerController *NewPlayer) override;
virtual void BeginPlay() override;
@ -28,23 +27,23 @@ public:
void CycleTurns();
private:
void InitializeSpawnPointsIfNeeded(AController* Player);
void InitializeSpawnPointsIfNeeded(AController *Player);
void InitializeBattleField() const;
UPROPERTY()
TMap<uint8, AMyPlayerStart*> SpawnPoints{};
TMap<uint8, AMyPlayerStart *> SpawnPoints{};
AMyPlayerController* GetMyPlayerController(uint8 const PlayerIndex) const;
AMyPlayerController *GetMyPlayerController(uint8 const PlayerIndex) const;
UFUNCTION(BlueprintCallable)
void StartGame();
UFUNCTION(BlueprintPure)
AMyPlayerController* PlayerInTurn() const;
AMyPlayerController *PlayerInTurn() const;
UFUNCTION(BlueprintPure)
AMyPlayerController* PlayerNotInTurn() const;
AMyPlayerController *PlayerNotInTurn() const;
UPROPERTY()
uint8 CurrentPlayerTurn{0};

@ -5,31 +5,22 @@
// Sets default values
AMyPawn::AMyPawn()
{
AMyPawn::AMyPawn() {
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AMyPawn::BeginPlay()
{
void AMyPawn::BeginPlay() {
Super::BeginPlay();
}
// Called every frame
void AMyPawn::Tick(float DeltaTime)
{
void AMyPawn::Tick(float DeltaTime) {
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
void AMyPawn::SetupPlayerInputComponent(UInputComponent *PlayerInputComponent) {
Super::SetupPlayerInputComponent(PlayerInputComponent);
}

@ -4,11 +4,11 @@
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "GameFramework/SpectatorPawn.h"
#include "MyPawn.generated.h"
UCLASS()
class TURNBASEDTUTORIAL_API AMyPawn : public APawn
{
class TURNBASEDTUTORIAL_API AMyPawn : public ASpectatorPawn {
GENERATED_BODY()
public:
@ -24,8 +24,6 @@ public:
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
virtual void SetupPlayerInputComponent(
class UInputComponent *PlayerInputComponent) override;
};

@ -5,98 +5,95 @@
#include "MyGameMode.h"
#include "Net/UnrealNetwork.h"
AMyPlayerController::AMyPlayerController() : Super(), bIsMyTurn(false), SelectedTrooper(nullptr)
{
AMyPlayerController::AMyPlayerController()
: Super(), bIsMyTurn(false), SelectedTrooper(nullptr) {
UE_LOG(LogTemp, Warning, TEXT("Player controller created"));
}
void AMyPlayerController::SetupInputComponent()
{
void AMyPlayerController::SetupInputComponent() {
Super::SetupInputComponent();
InputComponent->BindAction("MyAction", IE_Pressed, this,
&AMyPlayerController::OnLeftMouseClick);
}
void AMyPlayerController::SetMyTurn(bool bMyTurn)
{
void AMyPlayerController::SetMyTurn(bool bMyTurn) {
bIsMyTurn = bMyTurn;
if (bIsMyTurn)
{
if (bIsMyTurn) {
GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green,
FString::Printf(
TEXT("CURRENT TURN: %d"), PlayerIndex));
TEXT("CURRENT TURN: %d"),
PlayerIndex));
}
// OnMyTurnChanged.ExecuteIfBound(bIsMyTurn);
}
void AMyPlayerController::StartTurn_Implementation()
{
void AMyPlayerController::StartTurn_Implementation() {
SetMyTurn(true);
UE_LOG(LogTemp, Warning, TEXT("Your turn, %d"), PlayerIndex);
}
void AMyPlayerController::EndTurn_Implementation()
{
void AMyPlayerController::EndTurn_Implementation() {
SetMyTurn(false);
UE_LOG(LogTemp, Warning, TEXT("Not your turn, %d"), PlayerIndex);
}
auto AMyPlayerController::GetMyGameMode() const
{
return dynamic_cast<AMyGameMode*>(UGameplayStatics::GetGameMode(GetWorld()));
auto AMyPlayerController::GetMyGameMode() const {
return dynamic_cast<AMyGameMode *>(
UGameplayStatics::GetGameMode(GetWorld()));
}
void AMyPlayerController::MoveTrooper_Implementation(ATrooper* Trooper, FVector Location)
{
void AMyPlayerController::MoveTrooper_Implementation(
ATrooper *Trooper,
FVector Location) {
Trooper->MoveTrooper(Location);
GetMyGameMode()->CycleTurns();
}
void AMyPlayerController::AttackTrooper_Implementation(ATrooper* Attacker, ATrooper* Victim)
{
void AMyPlayerController::AttackTrooper_Implementation(
ATrooper *Attacker,
ATrooper *Victim) {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red,
FString::Printf(
TEXT("ATTACK!! %d attacked %d"), Attacker->GetId(), Victim->GetId()));
TEXT("ATTACK!! %d attacked %d"),
Attacker->GetId(), Victim->GetId()));
GetMyGameMode()->CycleTurns();
}
void AMyPlayerController::SetPlayerIndex(uint8 NewPlayerIndex)
{
void AMyPlayerController::SetPlayerIndex(uint8 NewPlayerIndex) {
PlayerIndex = NewPlayerIndex;
}
void AMyPlayerController::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
void AMyPlayerController::GetLifetimeReplicatedProps(
TArray<FLifetimeProperty> &OutLifetimeProps) const {
DOREPLIFETIME(AMyPlayerController, PlayerIndex);
}
void AMyPlayerController::OnLeftMouseClick()
{
if (!bIsMyTurn)
{
void AMyPlayerController::OnLeftMouseClick() {
if (!bIsMyTurn) {
return;
}
UE_LOG(LogTemp, Warning, TEXT("Mouse clicked"));
FHitResult HitResult;
bool const IsHitResult = GetHitResultUnderCursorByChannel(TraceTypeQuery1, false, HitResult);
bool const IsHitResult = GetHitResultUnderCursorByChannel(
TraceTypeQuery1, false, HitResult);
if (!IsHitResult)
return;
UE_LOG(LogTemp, Warning, TEXT("Got hit result"));
auto const NewlySelectedLocation = HitResult.Location;
ATrooper* NewlySelectedTrooper = dynamic_cast<ATrooper*>(HitResult.GetActor());
ATrooper *NewlySelectedTrooper = dynamic_cast<ATrooper *>(
HitResult.GetActor());
if (NewlySelectedTrooper == nullptr || !NewlySelectedTrooper->IsValidLowLevel())
{
if (NewlySelectedTrooper == nullptr || !NewlySelectedTrooper->
IsValidLowLevel()) {
// we selected something that is not a trooper (or trooper in shitty state...)
// probably we should move to it if we can...
UE_LOG(LogTemp, Warning, TEXT("Not a trooper"));
// if initial trooper is valid...
if (SelectedTrooper != nullptr && SelectedTrooper->IsValidLowLevel())
{
if (SelectedTrooper != nullptr && SelectedTrooper->IsValidLowLevel()) {
UE_LOG(LogTemp, Warning, TEXT("Do move"));
// move this mf
MoveTrooper(SelectedTrooper, NewlySelectedLocation);
@ -105,22 +102,19 @@ void AMyPlayerController::OnLeftMouseClick()
}
return;
}
UE_LOG(LogTemp, Warning, TEXT("New Selected Player Index %d"), NewlySelectedTrooper->GetPlayerIndex());
UE_LOG(LogTemp, Warning, TEXT("New Selected Player Index %d"),
NewlySelectedTrooper->GetPlayerIndex());
// skip re-selection
if (SelectedTrooper == NewlySelectedTrooper)
{
if (SelectedTrooper == NewlySelectedTrooper) {
UE_LOG(LogTemp, Warning, TEXT("Skip reselection"));
return;
}
// we selected valid trooper...
if (NewlySelectedTrooper->GetPlayerIndex() == PlayerIndex)
{
if (NewlySelectedTrooper->GetPlayerIndex() == PlayerIndex) {
UE_LOG(LogTemp, Warning, TEXT("Do reselect"));
// our move, selection
SelectedTrooper = NewlySelectedTrooper;
}
else
{
} else {
UE_LOG(LogTemp, Warning, TEXT("Attack or skip..."));
// maybe selected trooper had gone crazy...
if (SelectedTrooper == nullptr || !SelectedTrooper->IsValidLowLevel())

@ -6,15 +6,10 @@
#include "GameFramework/PlayerController.h"
#include "MyPlayerController.generated.h"
/**
*
*/
// DECLARE_DYNAMIC_DELEGATE_OneParam(FOnMyTurnChangedDelegate, bool, bMyTurn);
UCLASS()
class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController
{
class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController {
GENERATED_BODY()
public:
@ -31,10 +26,10 @@ public:
void EndTurn();
UFUNCTION(Server, Reliable)
void MoveTrooper(ATrooper* Trooper, FVector Location);
void MoveTrooper(ATrooper *Trooper, FVector Location);
UFUNCTION(Server, Reliable)
void AttackTrooper(ATrooper* Attacker, ATrooper* Victim);
void AttackTrooper(ATrooper *Attacker, ATrooper *Victim);
UFUNCTION()
void SetPlayerIndex(uint8 NewPlayerIndex);
@ -45,7 +40,8 @@ private:
UPROPERTY(Replicated)
uint8 PlayerIndex;
ATrooper* SelectedTrooper;
UPROPERTY()
ATrooper *SelectedTrooper;
void OnLeftMouseClick();

@ -1,73 +1,70 @@
#include "Trooper.h"
#include <Kismet/GameplayStatics.h>
#include "MyPlayerController.h"
#include "Net/UnrealNetwork.h"
// Sets default values
ATrooper::ATrooper()
{
ATrooper::ATrooper() {
bReplicates = true;
PrimaryActorTick.bCanEverTick = true;
Tags.Add(FName("Trooper"));
MyStaticMesh = CreateDefaultSubobject<UStaticMeshComponent>("Mesh");
RootComponent = MyStaticMesh;
static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshToUse(TEXT(
"StaticMesh'/Game/StarterContent/Props/SM_Chair.SM_Chair'"
));
if (MeshToUse.Object)
{
MeshPath = TEXT("StaticMesh'/Game/StarterContent/Props/SM_Chair.SM_Chair'");
static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshToUse(MeshPath);
if (MeshToUse.Object) {
MyStaticMesh->SetStaticMesh(MeshToUse.Object);
}
}
// void ATrooper::SetStaticMesh() const {
// static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshToUse(MeshPath);
// if (MeshToUse.Object) {
// MyStaticMesh->SetStaticMesh(MeshToUse.Object);
// }
// }
// Called when the game starts or when spawned
void ATrooper::BeginPlay()
{
void ATrooper::BeginPlay() {
Super::BeginPlay();
}
void ATrooper::Initialize(uint8 const NewPlayerIndex, FVector const SpawnLocation, uint8 const NewId)
{
void ATrooper::Initialize(uint8 const NewPlayerIndex,
FVector const SpawnLocation,
uint8 const NewId) {
PlayerIndex = NewPlayerIndex;
bIsMoving = false;
CurrentLocation = SpawnLocation;
Id = NewId;
}
void ATrooper::Tick(float const DeltaTime)
{
void ATrooper::Tick(float const DeltaTime) {
if (!bIsMoving)
return;
FVector PositionVector = (TargetLocation - CurrentLocation);
PositionVector.Normalize();
PositionVector *= (Speed * DeltaTime);
if (PositionVector.Size() >= (TargetLocation - CurrentLocation).Size())
{
if (PositionVector.Size() >= (TargetLocation - CurrentLocation).Size()) {
CurrentLocation = TargetLocation;
bIsMoving = false;
}
else
{
} else {
CurrentLocation += PositionVector;
}
SetActorLocation(CurrentLocation);
}
void ATrooper::MoveTrooper(FVector const NewPos)
{
void ATrooper::MoveTrooper(FVector const NewPos) {
TargetLocation = NewPos;
bIsMoving = true;
}
uint8 ATrooper::GetId() const
{
uint8 ATrooper::GetId() const {
return Id;
}
void ATrooper::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
void ATrooper::GetLifetimeReplicatedProps(
TArray<FLifetimeProperty> &OutLifetimeProps) const {
DOREPLIFETIME(ATrooper, PlayerIndex);
DOREPLIFETIME(ATrooper, CurrentLocation);
DOREPLIFETIME(ATrooper, TargetLocation);
@ -75,7 +72,20 @@ void ATrooper::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetime
DOREPLIFETIME(ATrooper, Id);
}
uint8 ATrooper::GetPlayerIndex() const
{
uint8 ATrooper::GetPlayerIndex() const {
return PlayerIndex;
}
//
// ATrooperWizard::ATrooperWizard() {
// MeshPath = TEXT(
// // "StaticMesh'/Game/CityofBrass_Enemies/Static/Wizard_StaticMesh.Wizard_StaticMesh'");
// "StaticMesh'/Game/CityofBrass_Enemies/Static/SkeletonMelee_StaticMesh.SkeletonMelee_StaticMesh'");
// SetStaticMesh();
// }
//
// ATrooperSkeletonMelee::ATrooperSkeletonMelee() {
// MeshPath = TEXT(
// "StaticMesh'/Game/CityofBrass_Enemies/Static/SkeletonMelee_StaticMesh.SkeletonMelee_StaticMesh'");
// SetStaticMesh();
// }

@ -1,21 +1,20 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/StaticMeshComponent.h"
#include "GameFramework/Character.h"
#include "Trooper.generated.h"
UCLASS()
class TURNBASEDTUTORIAL_API ATrooper : public ACharacter
{
class TURNBASEDTUTORIAL_API ATrooper : public ACharacter {
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ATrooper();
void Initialize(uint8 const NewPlayerIndex, FVector const SpawnLocation, uint8 const NewId);
void Initialize(uint8 const NewPlayerIndex,
FVector const SpawnLocation,
uint8 const NewId);
UFUNCTION()
uint8 GetPlayerIndex() const;
@ -31,10 +30,13 @@ protected:
virtual void Tick(float const DeltaTime) override;
// void SetStaticMesh() const;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
UStaticMeshComponent* MyStaticMesh;
UStaticMeshComponent *MyStaticMesh;
const TCHAR *MeshPath = nullptr;
private:
UPROPERTY(Replicated)
uint8 PlayerIndex;
@ -53,3 +55,21 @@ private:
UPROPERTY(Replicated)
bool bIsMoving = false;
};
// UCLASS()
// class ATrooperWizard : public ATrooper {
// GENERATED_BODY()
//
// public:
// ATrooperWizard();
//
// };
//
// UCLASS()
// class ATrooperSkeletonMelee : public ATrooper {
// GENERATED_BODY()
//
// public:
// ATrooperSkeletonMelee();
//
// };

Loading…
Cancel
Save