// © 2025 Naked People Team. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "NPCSpawner.generated.h"

class ANakedDesireGameMode;
class ANPC;

UCLASS()
class NAKEDDESIRE_API ANPCSpawner : public AActor
{
	GENERATED_BODY()

	UPROPERTY(EditDefaultsOnly)
	TArray<TSubclassOf<ANPC>> NPCClasses;

	UPROPERTY(EditAnywhere)
	bool AlwaysSpawn = false;

	UPROPERTY()
	ACharacter* PlayerCharacter = nullptr;

	bool IsPlayerInRange = false;

	UPROPERTY()
	ANakedDesireGameMode* GameMode = nullptr;

	UPROPERTY()
	TArray<ANPC*> NPCs;

	UPROPERTY(EditAnywhere, meta = (ClampMin = 1, ClampMax = 30, UIMin = 1, UIMax = 30))
	int MaxCountDay = 10;
	
	UPROPERTY(EditAnywhere, meta = (ClampMin = 1, ClampMax = 30, UIMin = 1, UIMax = 30))
	int MaxCountNight = 5;
	
public:	
	ANPCSpawner();

protected:
	virtual void BeginPlay() override;

private:
	void OnTimerTick();
	void OnNPCDestroyed(ANPC* NPC);
};
