// Project Lab - NHTV Igad

#pragma once

#include "SpawnerBase.h"
#include "PatrolSpawn.generated.h"

/**
 * 
 */
UCLASS()
class UNREALPROJECT_API APatrolSpawn : public ASpawnerBase
{
	GENERATED_BODY()
	
public:
	APatrolSpawn();
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
	virtual void Tick(float DeltaTime) override;
	
	virtual FVector SpawnResetPosition() override;
	UPROPERTY(EditAnywhere)
		float respawnTime;
	UPROPERTY(EditAnywhere, Category = "Gamestate Components")
		bool spawnContinuous;
	void SpawnMobs();

private:
	float m_respawnTimer;
	TArray<FVector> m_controlPoints;
	int32 m_controlPointSign;
	int32 m_currentControlPoint;
	TArray<float> m_respawnTimers;
	FVector m_lastPosition;
	bool m_isPulled;
	void m_RespawnMobs();
	class ANetworkPlayer* m_GetClosestPlayer();
};
