
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_ClientProjectile_Mine.h
// Author : Chris Wallace
// Date   : 25-Feb-2009
//
// Copyright (C) 2009 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __AVP_CLIENTPROJECTILE_MINE_H__
#define __AVP_CLIENTPROJECTILE_MINE_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

#include "Entity/PhysicalObject/Projectile/AVP_ClientProjectile_GenericProjectile.h"

////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////

class Asura_Animation;
class AVP_Message_MineClientUpdate;
class Asura_AnimationController_Animation;
class AVP_GenericProjectileData;
class Asura_Photon;

////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_ClientProjectile_Mine
// Author       : Chris Wallace
// Date         : 25-Feb-2009
//
// Description  : Class to handle the predator Mine
////////////////////////////////////////////////////////////////////////////////

class AVP_ClientProjectile_Mine : public AVP_ClientProjectile_GenericProjectile
{
public:
	// Public functions...
	static	void	Create(const Asura_Message* pxMessage);

	virtual	bool	HandleMessage	(const Asura_Message* pxMessage);

	virtual void	Update(void);

	// Static list accessors...
	static	AVP_ClientProjectile_Mine*							FindEntity	(const Asura_Guid uGuid)	{ return(s_xList.FindEntity(uGuid)); }
	static	const Asura_Hashed_List<AVP_ClientProjectile_Mine>*	GetList		(void)						{ return(&s_xList); }


protected:
	// Protected variables...

	// Protected functions...
	virtual void PostCreateInitialise();
	void OnStateChange(u_int uNewState);

	AVP_ClientProjectile_Mine          (const AVP_Message_ProjectileClientUpdate* pxData);
	virtual ~AVP_ClientProjectile_Mine ();

private:

	// should probably be kept in sync with the server object
	enum
	{
		MINE_IN_FLIGHT,
		MINE_ARMING,
		MINE_ARMED,
		MINE_TRIGGERED,
	};

	// Private typedefs...
	typedef AVP_ClientProjectile_GenericProjectile PARENT;

	// Private variables...
	u_int m_uMineState;
	float m_fStateTimer;
	float m_fDetonationOffset;

	Asura_Hash_ID m_uArmingSound;
	Asura_Hash_ID m_uTriggeredSound;
	Asura_Handle m_iTriggerSoundHandle;

	Asura_Photon* m_pxLightPhoton;

	static	Asura_Hashed_List<AVP_ClientProjectile_Mine>	s_xList;

	// test
	Asura_Container_InputState	m_xInputStateFlying;
	Asura_Container_InputState	m_xInputStateArming;
	Asura_Container_InputState	m_xInputStateArmed;
	Asura_Container_InputState	m_xInputStateArming_OnFocus;
	Asura_Container_InputState	m_xInputStateArmed_OnFocus;

	void UpdateMineContainerAttachmentState();

	// Private functions...
	AVP_ClientProjectile_Mine  ();
	AVP_ClientProjectile_Mine  (const AVP_ClientProjectile_Mine& xOther);
	AVP_ClientProjectile_Mine&	operator=	(const AVP_ClientProjectile_Mine& xOther);
};   // End of class 'AVP_ClientProjectile_Mine'.


#endif   // ifndef __AVP_CLIENTPROJECTILE_MINE_H__


/// End of file. ///
