
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_ServerEntity_CheckPointNode.h
// Author : Chris Wallace
// Date   : 28-June-2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

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

#ifndef __AVP_SERVERENTITY_CHECKPOINTNODE_H__
#define __AVP_SERVERENTITY_CHECKPOINTNODE_H__

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

#include "Entity/Asura_Entity.h"

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

class Tools_EntityTemplateInstance;


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

////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_ServerEntity_CheckPointNode
// Author       : Chris Wallace
// Date         : 28-June-2007
//
// Description  : Class to handle checkpoints
////////////////////////////////////////////////////////////////////////////////

class AVP_ServerEntity_CheckPointNode : public Asura_Entity_Server
{
	friend class Tools_Project_Entity_CheckPointNode;

public:
	// Public functions...
	static AVP_ServerEntity_CheckPointNode*	Create	(const Asura_Guid uGuid);

	// Overridden functions...
    virtual bool    HasClientEntities() const { return false; }
	virtual	bool	IsFilledFromChunkBuffer	(void) const	{ return(false); }
	virtual bool 	CanBeSavedToChunk		(void) const	{ return(true); }

	virtual	void	ReadFromChunkStream		(Asura_Chunk_Stream& xStream);
	virtual	void	WriteToChunkStream		(Asura_Chunk_Stream& xStream) const;

	virtual bool HandleMessage(const Asura_Message* pxMessage); // Handle messages

	// Accessor functions...
	void	TeleportTo	(const Asura_Vector_3& xPosition, const Asura_Quat& xOrientation)	{ m_xPosition = xPosition; m_xOrientation = xOrientation; }

	const Asura_Vector_3&	GetPosition		(void) const	{ return(m_xPosition); }
	const Asura_Quat&		GetOrientation	(void) const	{ return(m_xOrientation); }

	// Static accessor functions...
	static AVP_ServerEntity_CheckPointNode*								FindEntity	(const Asura_Guid uGuid)	{ return(s_xList.FindEntity(uGuid)); }
	static const Asura_Hashed_List<AVP_ServerEntity_CheckPointNode>*	GetList		(void)						{ return(&s_xList); }

#if defined(ASURA_TOOLS)
	// Template functions...
	virtual	void	ApplyChangesForTemplateInstance	(Tools_EntityTemplateInstance* pxInstance);
	virtual	bool	CanBeIncludedInTemplate			(void) const	{ return(true); }
#endif	// defined(ASURA_TOOLS)


protected:
	// Protected variables...

	// Protected functions...
	AVP_ServerEntity_CheckPointNode          (const Asura_Guid uGuid);
	virtual ~AVP_ServerEntity_CheckPointNode ();


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

	// Private variables...
	Asura_Vector_3	m_xPosition;		
	Asura_Quat		m_xOrientation;		

	// Static list variables...
	static Asura_Hashed_List<AVP_ServerEntity_CheckPointNode>	s_xList;

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

	AVP_ServerEntity_CheckPointNode&	operator=	(const AVP_ServerEntity_CheckPointNode& xOther);

};   // End of class 'AVP_ServerEntity_CheckPointNode'.


#endif   // ifndef __AVP_SERVERENTITY_CHECKPOINTNODE_H__


/// End of file. ///
