Slight refactoring and more logging

pull/5/head
eyakm1 2 years ago
parent cdd8c11f8b
commit 985612b4de

@ -23,7 +23,6 @@ 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);
FActorSpawnParameters const SpawnInfo;
uint8 TrooperCount = 0;

@ -3,7 +3,6 @@
#include "MyPlayerController.h"
#include "Kismet/GameplayStatics.h"
#include "MyGameMode.h"
#include "AIController.h"
#include "Net/UnrealNetwork.h"
AMyPlayerController::AMyPlayerController() : Super(), bIsMyTurn(false), SelectedTrooper(nullptr)
@ -24,8 +23,8 @@ void AMyPlayerController::SetMyTurn(bool bMyTurn)
if (bIsMyTurn)
{
GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green,
FString::Printf(
TEXT("YOUR TURN!")));
FString::Printf(
TEXT("CURRENT TURN: %d"), PlayerIndex));
}
// OnMyTurnChanged.ExecuteIfBound(bIsMyTurn);
}
@ -33,13 +32,13 @@ void AMyPlayerController::SetMyTurn(bool bMyTurn)
void AMyPlayerController::StartTurn_Implementation()
{
SetMyTurn(true);
UE_LOG(LogTemp, Warning, TEXT("Your turn"));
UE_LOG(LogTemp, Warning, TEXT("Your turn, %d"), PlayerIndex);
}
void AMyPlayerController::EndTurn_Implementation()
{
SetMyTurn(false);
UE_LOG(LogTemp, Warning, TEXT("Not your turn"));
UE_LOG(LogTemp, Warning, TEXT("Not your turn, %d"), PlayerIndex);
}
auto AMyPlayerController::GetMyGameMode() const

@ -20,6 +20,8 @@ class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController
public:
// FOnMyTurnChangedDelegate OnMyTurnChanged;
virtual void SetupInputComponent() override;
AMyPlayerController();
UFUNCTION(Client, Reliable)
@ -29,12 +31,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);
virtual void SetupInputComponent() override;
void AttackTrooper(ATrooper* Attacker, ATrooper* Victim);
UFUNCTION()
void SetPlayerIndex(uint8 NewPlayerIndex);

Loading…
Cancel
Save