⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnpc.h

📁 五行MMORPG引擎系统V1.0
💻 H
字号:
//GNpc.h
/*/////////////////////////////////////////////////////////////////

   李亦
	liease@163.com 4040719
	2006-7-14
/*/////////////////////////////////////////////////////////////////
#ifndef _RPG__GNPC_H_
#define _RPG__GNPC_H_

#ifndef _RPG__GOBJECTDEFINE_H_
#include "GObjectDefine.h"
#endif

#ifndef _RPG__GCHARACTER_H_
#include "GCharacter.h"
#endif

#ifndef _RPG__GDIALOG_H_
#include "rpg/gobjects/GDialog.h"
#endif

#ifndef _RPG__GTASK_H_
#include "rpg/gobjects/GTask.h"
#endif

namespace RPG
{
class GDialog;
class GPlayer;

#define DECLARE_NPC_MEMBER(Name)\
protected:\
	Vector<G##Name*>		m_ar##Name##s;\
public:\
	inline Vector<G##Name*>& Get##Name##s() {return m_ar##Name##s;}\
	inline BOOL Exist##Name	(G##Name* pGObject)\
	{ return m_ar##Name##s.search(pGObject) != -1;}\
	inline U32 Add##Name	(G##Name* pGObject)\
	{ return m_ar##Name##s.addExist(pGObject);}//m_ar##Name##s.push_back(pGObject); return m_ar##Name##s.size()-1;}



typedef struct tagGNpc //: public tagGCharacter
{
	U32	aiType;	//ai类型
	U32	nKind;	//NPC种类,如蛇、人、猪...
	//Vector<GTASK*>	m_arTasks;	//NPC提供的任务
}GNPC;



class GNpc : public GCharacter
{
	typedef GCharacter	Parent;
	friend class	RPGDatabase;

protected:
	GNPC					m_dataNPC;
	
	//NPC对话
	DECLARE_NPC_MEMBER(Dialog);
	//NPC任务
	DECLARE_NPC_MEMBER(Task);

public:
   enum EGNPCMasks 
	{
      //InitialUpdateMask =     1,//Parent::NextFreeMask,
	};


public:
	//构造/析构函数
	GNpc();
	virtual ~GNpc();


public:
	void ClearData(U32 dwState);
	inline IsAI(){return m_dataNPC.aiType != GAI_NONE;}

	void ProcessTalk(GPlayer* pGPlayer);
	BOOL GetCurTaskPiece(GTask*& pTask,GTaskPiece*& pPiece,EGTaskStates& state,GPlayer* pGPlayer);
	GDialog* GetFitDialog(GPlayer* pGPlayer);

#ifdef TGE_RPGCLIENT
	void UpdateAllTaskNpc(GPlayer* pGPlayer);

	static void ToggleNpc(GNpc* pNpc);
	static void ToggleTask(GTask* pTask);
#endif
public:
   //bool  OnNewDataBlock(RPGBaseData* dptr);
   //bool  OnNewGameBase(GameBase* dptr);

   void ProcessTick(const Move *move);
   void InterpolateTick(F32 delta);
   void AdvanceTime(F32 dt);
   void PreprocessMove(Move *move) {}

   U32  packUpdate  (NetConnection *conn, U32 mask, BitStream *stream);
   void unpackUpdate(NetConnection *conn,           BitStream *stream);

   //bool onAdd();
   //void onRemove();
   //void inspectPostApply();
   static void initPersistFields();
   //static void consoleInit();

public:
   DECLARE_CONOBJECT(GNpc); 
};//GNpc

//////////////////////////////////////////////
extern GNpc*	g_pGNpc;

//////////////////////////////////////////////
DECLARE_CONSOLETYPE(GNpc);

};//namespace RPG
#endif //_RPG__GNPC_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -