//---------------------------------------------------------------------------
// File			: AVP_Behaviour_Marine_InCover.h
// Created		: 29 / 10 / 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_INCOVER_H__
#define __AVP_BEHAVIOUR_MARINE_INCOVER_H__ 1
// END FILE WRAPPER ///////////////////////////////////////////

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

// FORWARD DECLARATIONS ///////////////////////////////////
class AVP_Brain_Actor_Marine;
class AVP_ServerNode_CoverpointNode;
class Asura_Blueprint;

//---------------------------------------------------------------------------
// Class		: AVP_Behaviour_Marine_InCover
// Description	: Behaviour to deal with being in cover
//---------------------------------------------------------------------------
class AVP_Behaviour_Marine_InCover : public Axon_Project_Behaviour
{
	typedef Axon_Project_Behaviour PARENT;

public:

	// InCover Update State Enum
	enum UpdateState
	{
		UNSET,
		ENTER_COVER,
		POPUP_FROM_COVER,
		PEEK_EMEREGE_FROM_COVER,
		STEP_OUT,
		STEP_IN,
		BACK_INTO_COVER,
		IN_COVER,
		MAX_STATES
	};

	enum AnimState
	{
		COVER_UNSET,
		COVER_IDLE,
		COVER_POPUP,
		IDLE,
		MAX_ANIM_STATES
	};

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

	// Public Functions...
	void		SetCoverPoint( Asura_Guid uGuid );

protected:

	// Protected virtuals...
	virtual bool 					Activate					( void );
	virtual void 					Deactivate					( void );
	virtual void					PerFrameUpdate				( const float fTimeslice );
	#ifndef ASURA_NO_DEBUG_OUTPUT
	virtual void					RenderDebugInfo				( void );
	#endif
	virtual bool HandleMessage(const Asura_Message* pxMessage );

	// protected functions
	void							SwitchToState				( UpdateState eState );
	void							SetUpdateState				( UpdateState eState )				{ m_eUpdateState = eState; }
	Asura_Guid						GetCoverPoint				( void )							{ return m_uCoverPoint; }
	UpdateState						GetUpdateState				( void ) const						{ return m_eUpdateState; }
	AVP_Brain_Actor_Marine*			GetMarineBrain				( void )							{ return m_pxMarineBrain; }

	void							RequestCoverAnimState		( AnimState eState );
	bool							IsInCoverIdle( void );
	bool							IsInCoverPopup( void );
	void							LookInCoversDirection( void );
	void							SelectPeekOrMove( void );
	void							SelectEmergePoint( void );
	void							SendEnterCoverMoveMessage( void );
	Asura_Hash_ID					GetEnterCoverAnimHash( void );
	void							SendPeekEmergeCoverMessage( void );
	Asura_Hash_ID					GetIntoPeekAnimHash( bool bIsLeftPeek );
	Asura_Hash_ID					GetPeekAnimHash( bool bIsLeftPeek );
	bool							IsPeekDirectionLeft(AVP_ServerNode_CoverpointNode* pxCoverPoint);
	void							SendStepOutOfCoverMessage( void );
	Asura_Hash_ID					GetStepOutAnimHash( bool bIsLeftPeek );
	void							SendStepIntoCoverMessage( void );
	Asura_Hash_ID					GetStepInAnimHash( bool bIsLeftPeek );
	Asura_Blueprint*				GetWeaponBlueprint( void );
	Asura_Blueprint*				GetCoverBlueprint( AVP_ServerNode_CoverpointNode* pxCoverPoint );
	

private:

	// Private Member Variables...
	UpdateState						m_eUpdateState;
	AVP_Brain_Actor_Marine*			m_pxMarineBrain;
	Asura_Guid						m_uCoverPoint;
	float							m_fIdleTimer;
	float							m_fPeekTimer;
	u_int							m_uEmergePointIndex;
	bool							m_bAdvanceState;

#ifndef ASURA_NO_DEBUG_OUTPUT
	float							m_fDebugRenderTimer;
#endif

	enum { CURRENT_CHUNK_VERSION = 0 };
};

#endif //__AVP_BEHAVIOUR_MARINE_INCOVER_H__

/// End Of File 'AVP_Behaviour_Marine_InCover.h'
