//---------------------------------------------------------------------------
// File			: AVP_Behaviour_Marine_Alert.h
// Created		: 12 / 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_ALERT_H__
#define __AVP_BEHAVIOUR_MARINE_ALERT_H__ 1
// END FILE WRAPPER ///////////////////////////////////////////

// INCLUDES ///////////////////////////////////////////////////////////

// Asura
#include "Core/Asura_LinkList.h"

// Core Axon
#include "Behaviour/Axon_Project_Behaviour.h"

// AVP
#include "Core/BrainTypes/AVP_Brain_Actor_Marine.h"

// FORWARD DECLARATIONS ///////////////////////////////////
class AVP_Brain_Actor_Marine;

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

public:

	// InCover Update State Enum
	enum UpdateState
	{
		UNSET,
		IGNORE_SOUND,
		TURN_TO_FACE,
		TURN_TO_FACE_MT_BLIP,
		SCAN_AREA,
		TAKE_COVER,
		MOVE_TO_COVER,
		REGOGNISE_FRIENDLIES_THREAT,
		INVESTIGATE, 
		TURN_TO_FACE_POSITION,
		MAX_STATES
	};

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

	// Public Member Functions...
	UpdateState						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							SetLookDirection		(const float fTimeslice);
	void							IncreaseAlertTimer		(const float fTimeslice)		{m_fAlertTimer += fTimeslice;}
	float							GetAlertTimer			(void)							{return m_fAlertTimer;}

	void			GetActionToPerfromFromSoundType( void );
	void			SetUpdateState( UpdateState eState )		{ m_eUpdateState = eState; }
	void			FindBestPosition( AVP_Navigation::PosEvalFunctor* pxPosEval );
	static u_int	ScoreWaypoints( AVP_Navigation::AVP_PosEvalParams xPosEvalParams );

private:

	// Private Member Variables...
	UpdateState						m_eUpdateState;
	AVP_Brain_Actor_Marine*			m_pxMarineBrain;
	float							m_fAlertTimer;
	Asura_Vector_3					m_xLastHeardPosition;
	bool							m_bInvestigator;
	Asura_Guid						m_uSquadControllerGuid;
	bool							m_bNewLookSet;
	float							m_fLookTimer;
	u_int							m_uAlertAction;
	Asura_Guid						m_uAlertGuid;
	float							m_fLookTimeOut;
	bool							m_bIsInvestigator;
	u_int							m_uSoundType;
	Asura_Guid						m_uSquadGuid;
	bool							m_bHasBeenAiming;
	bool							m_bDialogueUsed;

	static Asura_Guid				s_uLastAlertGuidForDialogue;
	

	enum { CURRENT_CHUNK_VERSION = 0 };

};

#endif //__AVP_BEHAVIOUR_MARINE_ALERT_H__

/// End Of File 'AVP_Behaviour_Marine_Alert.h'
