Some fixes and debug output

pull/5/head
eyakm1 2 years ago
parent c86a21fa67
commit 6f5376e01d

@ -11,9 +11,12 @@ AMyGameMode::AMyGameMode() : Super() {
DefaultPawnClass = AMyPawn::StaticClass();
}
AActor *AMyGameMode::ChoosePlayerStart(AController *Player) {
AActor *AMyGameMode::ChoosePlayerStart_Implementation(AController *Player) {
UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart %d"), GetNumPlayers());
InitializeSpawnPointsIfNeeded();
return *SpawnPoints.Find(GetNumPlayers());
auto ptr = *SpawnPoints.Find(GetNumPlayers());
UE_LOG(LogTemp, Warning, TEXT("GameMode ChoosePlayerStart end %d"), ptr->GetPlayerIndex());
return ptr;
}
void AMyGameMode::InitializeSpawnPointsIfNeeded() {
@ -21,7 +24,8 @@ void AMyGameMode::InitializeSpawnPointsIfNeeded() {
return;
}
for (TActorIterator <AMyPlayerStart> PlayerStartIterator(GetWorld()); PlayerStartIterator; ++PlayerStartIterator) {
SpawnPoints[PlayerStartIterator->GetPlayerIndex()] = *PlayerStartIterator;
UE_LOG(LogTemp, Warning, TEXT("PlayerStart iterator %d"), PlayerStartIterator->GetPlayerIndex());
SpawnPoints.Add(PlayerStartIterator->GetPlayerIndex(), *PlayerStartIterator);
}
}

@ -23,7 +23,7 @@ public:
void BeginPlay() override;
AActor *ChoosePlayerStart(AController * Player);
AActor *ChoosePlayerStart_Implementation(AController * Player);
private:
void StartGame();

@ -1,5 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyPlayerState.h"

@ -1,17 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerState.h"
#include "MyPlayerState.generated.h"
/**
*
*/
UCLASS()
class TURNBASEDTUTORIAL_API AMyPlayerState : public APlayerState
{
GENERATED_BODY()
};
Loading…
Cancel
Save