//---------------------------------------------------------------------------
// File			: AVP_Behaviour_Marine_Patrol.h
// Created		: 13 / 11 / 07
// Created By	: Gareth Thomas
// Copyright (C) 2007 Rebellion. All Rights Reserved.
//---------------------------------------------------------------------------

// BEGIN FILE WRAPPER ///////////////////////////////////////
#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif
#ifndef __AVP_BEHAVIOUR_MARINE_PATROL_H__
#define __AVP_BEHAVIOUR_MARINE_PATROL_H__ 1
// END FILE WRAPPER ///////////////////////////////////////////

// INCLUDES ///////////////////////////////////////////////////////////
#include "Behaviour/Axon_Project_Behaviour.h"

// FORWARD DECLARATIONS ///////////////////////////////////
class AVP_Brain_Actor_Marine;
class AVP_ServerNode_GuardZone;
class AVP_ServerNode_OrientedNode;

//---------------------------------------------------------------------------
// Class		: AVP_Behaviour_Marine_Patrol
// Description	: 
//---------------------------------------------------------------------------
class AVP_Behaviour_Marine_Patrol : public Axon_Project_Behaviour
{
	typedef Axon_Project_Behaviour PARENT;

public:

	// InCover Update State Enum
	enum PatrolUpdateState
	{
		UNSET,
		SELECT_GUARD_ZONE,
		SELECT_PATROL_POINT,
		MOVE_TO_PATROL_POINT,
		WAIT_AT_PATROL_POINT,
		ALERT,
		MAX_STATES
	};

	// Construction / Deconstruction
	AVP_Behaviour_Marine_Patrol								(AVP_Brain_Actor_Marine* pxBrain);
	virtual ~AVP_Behaviour_Marine_Patrol					(void)							{}

	// Public Member Functions...
	PatrolUpdateState				GetUpdateState			(void) const					{return m_eUpdateState;}
	AVP_Brain_Actor_Marine*			GetMarineBrain			(void)							{return m_pxMarineBrain;}

protected:
	virtual bool 					Activate				(void);
	virtual void 					Deactivate				(void);
	virtual void					PerFrameUpdate			(const float fTimeslice);
#ifndef ASURA_NO_DEBUG_OUTPUT
	virtual void					RenderDebugInfo			(void);
#endif

	void							SetUpdateState			(PatrolUpdateState eState)		{m_eUpdateState = eState;}

	bool							FindClosestGuardPoint	(void);
	bool							CheckForThreat			(void);
	void							SetLookAtFromNode		(void);
	AVP_ServerNode_GuardZone*		GetGuardZone			(void);
	AVP_ServerNode_OrientedNode*	GetPatrolPoint			(void);

	bool SelectGuardZone(void);

private:

	// Private Member Variables...
	PatrolUpdateState				m_eUpdateState;
	AVP_Brain_Actor_Marine*			m_pxMarineBrain;
	Asura_Guid						m_uGuardZoneGuid;
	float							m_fWaitTime;
	int								m_iCurrentPatrolIndex;
	Asura_Guid						m_uCurrentPatrolGuid;
	Asura_Guid						m_uPreviousPatrolGuid;
	

	enum { CURRENT_CHUNK_VERSION = 0 };

};

#endif //__AVP_BEHAVIOUR_MARINE_PATROL_H__

/// End Of File 'AVP_Behaviour_Marine_Patrol.h'
