//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_FaceHugger_HideInShadows.h
//
// Copyright (C) 2008 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_FACEHUGGER_HIDEINSHADOWS_H__
#define __AVP_BEHAVIOUR_FACEHUGGER_HIDEINSHADOWS_H__ 1

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

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

// asura
#include "Network/Asura_Guid.h"

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

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

class Asura_Message;
class AVP_Brain_Actor_FaceHugger;
struct AVP_FaceHuggerTeam_Knowledge;
class AVP_Behaviour_FaceHugger_MoveToPrey;
//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_FaceHugger_HideInShadows
//
//////////////////////////////////////////////////////////////////////////////

class AVP_Behaviour_FaceHugger_HideInShadows : public Axon_Project_Behaviour
{
	typedef Axon_Project_Behaviour PARENT;

public:
	AVP_Behaviour_FaceHugger_HideInShadows( AVP_Brain_Actor_FaceHugger* pxBrain );

protected:
	virtual bool Activate();
	virtual void Deactivate();
	virtual void Update( const float fTimeslice );
	virtual void PerFrameUpdate( const float fTimeslice );


#ifndef ASURA_NO_DEBUG_OUTPUT
	virtual void RenderDebugInfo();
#endif

private:
	enum State
	{
		UNSET,
		IDLE,
		WANDER,
		MOVE_IN_SHADOWS,
		HIDE_IN_SHADOWS,
		MOVE_TO_PREY,
		ATTACKING,
		RETURN_HOME
	};


	AVP_Brain_Actor_FaceHugger* GetFaceHuggerBrain() const;
	void SwitchToState( const State eState );

	void PlanPathToShadow();
	void UpdateMovingInShadows(float fTimeSlice);
	void UpdateHideInShadows(float fTimeSlice);

	void UpdateHiddenStatus(float fTimeSlice);
	bool TookDamage();
	bool IsInAdajcentGPV(Asura_Guid uTargetGPV) const;

private:
	float m_fTimeSinceLastFindTarget;
	u_int m_uLightGeneration;
	float m_fTimeTotallyVisible;
	float m_fTimeTotallyInvisible;
	float m_fTimeVisibleByMarineLight;
	float m_fTimeSinceVisibleByMarineLight;

	float m_fMaxDistanceSq;
	float m_fLastHealth;
	float m_fTimeTillStopAllowed;
	float m_fTimeToStayHiddenInShadows;
	Asura_Vector_3 m_xTargetPositionDuringPlan;

};

//////////////////////////////////////////////////////////////////////////////
//
// 
//
//////////////////////////////////////////////////////////////////////////////

#endif //__AVP_BEHAVIOUR_FACEHUGGER_HIDEINSHADOWS_H__
