// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "AICharacter.h"
#include "BehaviorTree/BehaviorTree.h"
#include "GameFramework/Character.h"
#include "EnemyCharacter.generated.h"

UCLASS()
class ENDLESSVENDETTA_API AEnemyCharacter : public AAICharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AEnemyCharacter();
	UPROPERTY(BlueprintReadWrite)
	bool WeaponRaised = false;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	class AAIControlHub* DelegatedControlHub;
	virtual void OnDeath() override;

public:
	// Called every frame
	virtual void Tick(float DeltaTime) override;
	UFUNCTION(BlueprintCallable)
	void SubscribeToGroupAIEvents(class AAIControlHub* ControlHub);
	void SetLocalAlertLevel(int NewAlertLevel) const;

	//Animation Blueprint Triggers
	UFUNCTION(BlueprintNativeEvent)
	void EquipWeapon();
	virtual void EquipWeapon_Implementation();
	UFUNCTION(BlueprintNativeEvent)
	void DeEquipWeapon();
	virtual void DeEquipWeapon_Implementation();
	UFUNCTION(BlueprintNativeEvent)
	void SetFiring(bool IsFiring);
	virtual void SetFiring_Implementation(bool IsFiring);
	
private:
	FDelegateHandle AlertLevelDelegateHandle;
	FDelegateHandle HuntPlayerDelegateHandle;
	void SetAlertLevel(int NewAlertLevel) const;
	void HuntPlayer(FVector PlayerLastKnowLocation);
};
