
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_ServerEntity_Projectile.h
// Author : Andy Tate
// Date   : 14-Nov-2006
//
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

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

#ifndef __AVP_SERVERENTITY_PROJECTILE_H__
#define __AVP_SERVERENTITY_PROJECTILE_H__

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

#include "Entity/PhysicalObject/AVP_ServerEntity_PhysicalObject.h"


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

class Asura_LOS_InputData;
class Asura_LOS_OutputData;


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_ServerEntity_Projectile
// Author       : Andy Tate
// Date         : 14-Nov-2006
//
// Description  : Abstract class to handle the server-side generic projectiles.
////////////////////////////////////////////////////////////////////////////////

class AVP_ServerEntity_Projectile : public AVP_ServerEntity_PhysicalObject
{
public:
	// Public functions...
	float GetDamageMultiplier() const { return m_fDamageMultiplier; }
	bool IsDisarmed() const { return m_bIsDisarmed; }
	void SetDisarmed(bool bDisarmed) { m_bIsDisarmed = bDisarmed; }

	// Launch functions...
	virtual void	Launch	(const Asura_Vector_3& xPosition, const Asura_Matrix_3x3& xOrientation, const Asura_Vector_3& xVelocity, const Asura_Guid uGuidToIgnore, float fDamageMultiplier);

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


protected:
	// Protected variables...
	float			m_fDamageMultiplier;
	Asura_Vector_3	m_xPrevLOSPosition;
	bool			m_bIsDisarmed;

	// Protected functions...
	AVP_ServerEntity_Projectile          (const Asura_Guid uGuid, const Asura_Guid uOwnerGuid);
	virtual ~AVP_ServerEntity_Projectile (void);

	virtual bool	CheckForCollisionsUsingLOS( const Asura_Vector_3& xPosition, const Asura_Vector_3& xVelocity );

	// Abstract event functions...
    virtual	void	OnCollision		(const Asura_LOS_InputData& xLOSInputData, const Asura_LOS_OutputData& xLOSOutputData) {}
	virtual	void	OnImpact		( const Asura_Vector_3& xImpactPoint, const Asura_Vector_3& xImpactNormal = Asura_Maths::ZeroVector3 ) {}
    virtual	void	OnLaunch		(void) {}

	virtual	void	MakeClientUpdateMessage	(void);

private:
	// Private typedefs...
	typedef AVP_ServerEntity_PhysicalObject PARENT;

	// Private variables...
	static	Asura_Hashed_List<AVP_ServerEntity_Projectile>	s_xList;

	// Private functions...
	AVP_ServerEntity_Projectile  (void);
	AVP_ServerEntity_Projectile  (const AVP_ServerEntity_Projectile& xOther);

	AVP_ServerEntity_Projectile&	operator=	(const AVP_ServerEntity_Projectile& xOther);

};   // End of class 'AVP_ServerEntity_Projectile'.


#endif   // ifndef __AVP_SERVERENTITY_PROJECTILE_H__


/// End of file. ///
