//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_Dropship_FireMissiles.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_DROPSHIP_FIREMISSILES_H__
#define __AVP_BEHAVIOUR_DROPSHIP_FIREMISSILES_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 "Core/Asura_LinkList.h"

// avp 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 AVP_Brain_Actor_Dropship;
class AVP_ServerNode_VantagePoint_Dropship;

//////////////////////////////////////////////////////////////////////////////
//
// AVP_Behaviour_Dropship_FireMissiles
//
//////////////////////////////////////////////////////////////////////////////

class AVP_Behaviour_Dropship_FireMissiles : public Axon_Project_Behaviour
{
    typedef Axon_Project_Behaviour PARENT;

public:
    AVP_Behaviour_Dropship_FireMissiles( AVP_Brain_Actor_Dropship* pxBrain );

	void SetNumberOfMissiles(u_int uNumberOfMissiles);
	void UseFrontPods();
	void UseBackPods();

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

#ifndef ASURA_NO_DEBUG_OUTPUT
    virtual void RenderDebugInfo();
#endif

    AVP_Brain_Actor_Dropship* GetDropshipBrain() const;

private:

	Asura_Guid GetTarget() const;
	
    enum State
    {
        UNSET,
		AIM_AT_TARGET,
		OPEN_DOORS,
		FIRE_MISSILE,
		CLOSE_DOORS,
		WAIT_MISSILES_EXPLOSION,
		FINISHED,
        NUM_STATES
    };

    void SwitchToState( const State eNextState );

private:

	bool IsReadyToFire();
	void FireMissiles(float fTimeSlice);
	void UpdateLaser();

	
	State m_eCurrentState;
    float m_fTimeInState;

	bool m_bUseFrontPods;
	bool m_bIsMissileReady;
	u_int m_uNumberOfMissiles;
	bool m_bNextFireLeft;
	float m_fTimeSinceLastFire;

	bool m_bUpdateLaser;
	bool m_bIsLaserOn;
};

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

#endif //__AVP_BEHAVIOUR_DROPSHIP_FIREMISSILES_H__
