// Project Lab - NHTV Igad

#pragma once

#include "DefaultGameState.h"
#include "KOTHTeamState.h"
#include "KOTHGameState.generated.h"

UCLASS()
class AKOTHGameState : public ADefaultGameState
{
	GENERATED_BODY()
public:
	void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const;

	UFUNCTION(BlueprintCallable, Category="Game")
	FKOTHTeamState GetTeam(int32 team) const;

	UFUNCTION(NetMulticast, Reliable)
	void BroadcastOnHillCaptured(int32 team);

	DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHillCaptured, int32, team);
	UPROPERTY(BlueprintAssignable, Category="Game")
	FOnHillCaptured onHillCaptured;

	UPROPERTY(Replicated, ReplicatedUsing=m_OnRep_Overtime, BlueprintReadOnly)
	bool overtime;
	UPROPERTY(Replicated, BlueprintReadOnly)
	TArray<FKOTHTeamState> kothTeams;
	UPROPERTY(Replicated, BlueprintReadOnly)
	float maxGameScore;

private:
	UFUNCTION()
	void m_OnRep_Overtime();

	friend class AKingOfTheHillGameMode;
};
