//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_AVP3Alien_AttackThreat.h
//
// 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_AVP3ALIEN_ATTACKTHREAT_H__
#define __AVP_BEHAVIOUR_AVP3ALIEN_ATTACKTHREAT_H__ 1

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

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

#include "Actor/Vertebrates/Alien/AVP_Alien_Description.h"
#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 Axon_Project_Brain;
class AVP_Alien_Description;

//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_AVP3Alien_AttackThreat
//
//////////////////////////////////////////////////////////////////////////////

class AVP_Behaviour_AVP3Alien_AttackThreat : public Axon_Project_Behaviour
{
    typedef Axon_Project_Behaviour PARENT;

public:
    AVP_Behaviour_AVP3Alien_AttackThreat( Axon_Project_Brain* pxBrain );

    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

	void SetTargetGuid( Asura_Guid uTargetGuid ) { m_uTargetGuid = uTargetGuid; }
private:

    enum State
    {
        STATE_INIT,
		STATE_ATTACK,
        STATE_RETURN,

		NUM_STATES
	};

	enum
	{
		ATTACK_TYPE_CLAW_1,
		ATTACK_TYPE_CLAW_2,
		ATTACK_TYPE_TAIL,
		NUM_ATTACK_TYPE
	};

	// TODO: Fix up the whole damage system after the demo, 'cause this looks pretty ugly
	struct AttackType
	{
		AVP_Alien_Description::AnimationType	eAnimType;
		AVP_Alien_Description::AnimationType	eReturnAnimType;
		float									fMinDistSq;
		float									fMaxDistSq;
		float									fDoubleAttackProb;

		u_int									uDamageType;
		u_int									uDirectionalDamageType;
		Asura_Hash_ID							uMarkerHashID;
		float									fDamageTime;

		float									fDamageAmount;
		float									fDamageImpulseStrength;
		float									fProjectionDistance;

		bool									bLimbAvailable;
	};

	AttackType m_axAttackAnims[NUM_ATTACK_TYPE];
	u_int m_uCurrentAttackType;
	float m_fCurrentAttackTimer;
	bool m_bDamageDealt;
	bool m_bSecondAttackPossible;

	Asura_Guid m_uTargetGuid;

	void SwitchToState( const State eNextState );
};

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

#endif //__AVP_BEHAVIOUR_AVP3ALIEN_ATTACKTHREAT_H__
