#pragma once
#include "IExamPlugin.h"
#include "Exam_HelperStructs.h"

namespace BT
{
	class BehaviorTree;
}

class IBaseInterface;
class IExamInterface;
class Blackboard;
class Thinker;
class WorldExplorationGrid;


class SurvivalAgentPlugin final : public IExamPlugin
{
public:
	SurvivalAgentPlugin() = default;
	virtual ~SurvivalAgentPlugin() override;

	void Initialize(IBaseInterface* pInterface, PluginInfo& info) override;
	void DllInit() override;
	void DllShutdown() override;

	void InitGameDebugParams(GameDebugParams& params) override;
	void Update_Debug(float dt) override;

	SteeringPlugin_Output UpdateSteering(float dt) override;
	void Render(float dt) const override;

private:
	//Interface, used to request data from/perform actions with the AI Framework
	IExamInterface* m_pInterface = nullptr;

	Elite::Vector2 m_Target = {};
	bool m_CanRun = false; //Demo purpose
	bool m_GrabItem = false; //Demo purpose
	bool m_UseItem = false; //Demo purpose
	bool m_RemoveItem = false; //Demo purpose
	bool m_DestroyItemsInFOV = false;
	float m_AngSpeed = 0.f; //Demo purpose

	UINT m_InventorySlot = 0;

	Blackboard* CreateBlackboard();
	void UpdateBlackboard(const SteeringPlugin_Output& steering);
	BT::BehaviorTree* m_BehaviourTree = nullptr;
	Thinker* m_Thinker = nullptr;

	WorldExplorationGrid* m_pExplorationGrid = nullptr;

	bool m_Running{ false };
};

//ENTRY
//This is the first function that is called by the host program
//The plugin returned by this function is also the plugin used by the host program
extern "C"
{
	inline __declspec (dllexport) IPluginBase* Register()
	{
		return new SurvivalAgentPlugin();
	}
}