#include "Core/Asura.h"

#ifdef AVP_USE_INPUT_SIMULATOR

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif

#ifndef __AVP_INPUTSIMULATOR_BEHAVIOUR_PREDATOR_PATROL_H__
#define __AVP_INPUTSIMULATOR_BEHAVIOUR_PREDATOR_PATROL_H__

#include "Core/AVP_Navigation.h"
#include "Entity/PhysicalObject/Actor/AVP_ClientEntity_Actor.h"
#include "InputSimulator/AVP_InputSimulator_Behaviour.h"

// This behaviour path finds and moves the player. Spawns a child behaviour Hunt which will seek for the player while navigating the map.

class AVP_InputSimulator_Behaviour_Predator_Patrol : public AVP_InputSimulator_Behaviour
{
	public:
		AVP_InputSimulator_Behaviour_Predator_Patrol();

		void Update( u_char* ucCurrentInput, float* pfAxisValue );

	private:
		enum UpdateState
		{
			SELECT_RANDOM_POSITION,
			SETUP_PATH,
			MOVE,
			NOT_SET
		};
		UpdateState m_eUpdateState;
		
		void SetUpdateState( UpdateState eState ) { m_eUpdateState = eState; };

	private:
		bool SelectRandomWaypoint();
		bool SelectWaypointCloseToRandomEnemy();
		bool SetupPath();
		bool Move( u_char* ucCurrentInput, float* pfAxisValue );

		void DoActions( u_char* ucCurrentInput, float* pfAxisValue );
		void UpdateOrientation( float* pfAxisValue, Asura_Vector_3 xToTarget );
		void MoveTowardsWaypoint( const Asura_Vector_3 xPlayerPosition, const Asura_AI_NavVertex* pxNextWaypoint, u_char* ucCurrentInput, float* pfAxisValue );

		AVP_ClientEntity_Actor* GetPlayer();

		AVP_Navigation::NavData m_xNavData;
		u_short m_uNearestWaypoint;
		u_short m_uWaypointIndex;
		bool	m_bCalculateStuckTimer;
		bool	m_bUseFocus;
		u_int	m_uPathfindingTries;
		float	m_fJumpTimer;
		float	m_fFocusTimer;
		float	m_fCloakTimer;
		float	m_fStuckTimer;
};

#endif // __AVP_INPUTSIMULATOR_BEHAVIOUR_PATROL_H__

#endif // AVP_USE_INPUT_SIMULATOR
