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

#pragma once

#include "CoreMinimal.h"
#include "DetourCrowdAIController.h"
#include "Perception/AIPerceptionTypes.h"
#include "NPCAIController.generated.h"

class ANakedDesireGameMode;
class UNavigationSystemV1;
class ANakedDesireCharacter;

UCLASS()
class NAKEDDESIRE_API ANPCAIController : public ADetourCrowdAIController
{
	GENERATED_BODY()

	UPROPERTY()
	ANakedDesireCharacter* PlayerCharacter = nullptr;

	UPROPERTY()
	const UNavigationSystemV1* NavigationSystem = nullptr;

	UPROPERTY()
	ANakedDesireGameMode* GameMode = nullptr;

	UPROPERTY(EditDefaultsOnly)
	UBehaviorTree* BehaviorTreeAsset = nullptr;

	bool bCurrentlyObserving = false;

public:
	UFUNCTION(BlueprintCallable)
	void SetShouldReactToPlayer(bool Value);

protected:
	UFUNCTION()
	void OnTargetPerceptionUpdate(AActor* Actor, FAIStimulus Stimulus);
	
	virtual void OnPossess(APawn* InPawn) override;
	virtual void OnUnPossess() override;
};
