//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_Shared_GoTo.h
//
// Created by Adam Law - 19 April 2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif

#ifndef __AVP_BEHAVIOUR_SHARED_GOTO_H__
#define __AVP_BEHAVIOUR_SHARED_GOTO_H__

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

// Asura specific
#ifndef ASURA_NO_DEBUG_OUTPUT
	#include "Rendering/Asura_Font_System.h"
#endif

// Axon specific
#include "Behaviour/BehaviourTypes/AVP_Behaviour_Shared_RouteHelper.h"

// Project specific
#include "Entity/PhysicalObject/Actor/AVP_ServerEntity_Actor.h"
#include "Entity/GoToPoints/AVP_ServerEntity_GoToPoint.h"
//#include "Entity/Controller/AVP_ServerEntity_AIPointController.h"

// F O R W A R D   D E C L A R A T I O N S ///////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_Behaviour_Shared_GoTo.h
// Author : Adam Law
// Date   : 19-Apr-2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

class AVP_Behaviour_Shared_GoTo : public AVP_Behaviour_Shared_RouteHelper
{
    typedef AVP_Behaviour_Shared_RouteHelper PARENT;

public:
    AVP_Behaviour_Shared_GoTo( Axon_Project_Brain* pxBrain );
    virtual ~AVP_Behaviour_Shared_GoTo();	

protected:
	// Overridden Functions
    bool Activate();								// Triggers the Go To behaviour
	void Deactivate();								// Deactivates the Go To behaviour
	void Update( const float fTimeslice );			// Only gets called every now & then
	void PerFrameUpdate( const float fTimeslice);	// Per frame

	const bool SetDestination( const Asura_Vector_3& vTarget, const float fTimeslice );
	void SwitchAway();
	void StopMoving();

#ifndef ASURA_NO_DEBUG_OUTPUT
	virtual void RenderDebugInfo();
#endif
	
private:
	bool GetGoToPoint();

	AVP_ServerEntity_Actor*				m_pxActor;
	AVP_ServerEntity_GoToPoint*			m_pxGoToPoint;		// Pointer to destination Go To Point
	bool								m_bIsAlien;	   

	enum UpdateState
    {
        US_UNSET,
		US_GET_GO_TO,		
		US_NAV_ROUTE,  
		US_FINISHED,
		
        US_NUM_UPDATE_STATES
    } m_eUpdateState;
};

#endif //__AVP_BEHAVIOUR_SHARED_GOTO_H__
