diff --git a/Source/TurnBasedTutorial/MyGameMode.cpp b/Source/TurnBasedTutorial/MyGameMode.cpp index 1a9aff9..5a52fa9 100644 --- a/Source/TurnBasedTutorial/MyGameMode.cpp +++ b/Source/TurnBasedTutorial/MyGameMode.cpp @@ -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; diff --git a/Source/TurnBasedTutorial/MyPlayerController.cpp b/Source/TurnBasedTutorial/MyPlayerController.cpp index 99de807..991d020 100644 --- a/Source/TurnBasedTutorial/MyPlayerController.cpp +++ b/Source/TurnBasedTutorial/MyPlayerController.cpp @@ -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 diff --git a/Source/TurnBasedTutorial/MyPlayerController.h b/Source/TurnBasedTutorial/MyPlayerController.h index 146c175..195aee2 100644 --- a/Source/TurnBasedTutorial/MyPlayerController.h +++ b/Source/TurnBasedTutorial/MyPlayerController.h @@ -20,6 +20,8 @@ class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController public: // FOnMyTurnChangedDelegate OnMyTurnChanged; + virtual void SetupInputComponent() override; + AMyPlayerController(); UFUNCTION(Client, Reliable) @@ -29,19 +31,17 @@ 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); - + private: bool bIsMyTurn; - + UPROPERTY(Replicated) uint8 PlayerIndex;