// Project Lab - NHTV Igad

#include "UnrealProject.h"
#include "DefaultGameMode.h"
#include "PlayerSpawn.h"


APlayerSpawn::APlayerSpawn()
{
	displayMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	displayMesh->bHiddenInGame = true;
	displayMesh->bGenerateOverlapEvents = false;
	displayMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
	displayArrow = CreateDefaultSubobject<UArrowComponent>(TEXT("Arrow"));
	assignedTeam = 0;
}

void APlayerSpawn::BeginPlay()
{
	if (Role != ROLE_Authority)
		return;

	ADefaultGameMode* mode = Cast<ADefaultGameMode>(GetWorld()->GetAuthGameMode());
	if (mode)
		mode->RegisterPlayerSpawn(*this);
}