// Project Lab - NHTV Igad

#include "UnrealProject.h"
#include "KOTHGameState.h"


void AKOTHGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	DOREPLIFETIME(AKOTHGameState, kothTeams);
	DOREPLIFETIME(AKOTHGameState, maxGameScore);
	DOREPLIFETIME(AKOTHGameState, overtime);
}

FKOTHTeamState AKOTHGameState::GetTeam(int32 team) const
{
	// Team to array index [1-5] -> [0-4]
	team -= 1;
	if(team >= 0 && team < kothTeams.Num())
		return kothTeams[team];
	return FKOTHTeamState();
}

void AKOTHGameState::BroadcastOnHillCaptured_Implementation(int32 team)
{
	onHillCaptured.Broadcast(team);
}
void AKOTHGameState::m_OnRep_Overtime()
{
	GPRINT("Overtime = " + overtime);
}
