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

📄 gameunit.h

📁 混乱竞技场的全套代码,客户端资源可以网上搜
💻 H
字号:
// GameUnit.h: interface for the GameUnit class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GAMEUNIT_H__77FC7259_1184_4B37_9D97_54DC5DAC0FEA__INCLUDED_)
#define AFX_GAMEUNIT_H__77FC7259_1184_4B37_9D97_54DC5DAC0FEA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

struct  UNIT_EFFECT_TIP{
	CGsTexture		tex;
	float			pos_x;
	float			pos_y;
	float			pos_h;
	float			alpha;
	float			scale;
	FLAG			flag;
};

struct PARTICLE_MAGIC {
	STRUCT_EFFECT_SPECIFIC	ses;
	CGsParticleEmitter		particles;
	GSANI*					p_ani;
	float			pos_x;
	float			pos_y;
	float			pos_h;
	float			speed;
	float			angle;
	LONG			life;
};

#define	ACTION_LOST		10 

#define UNIT_EFFECT_FLAG_DAMAGE		1
#define UNIT_EFFECT_FLAG_CURE		2

class Game_Unit : public GM_Unit  
{
	friend MainGame;
public:
	virtual LONG Update();
	virtual VOID Cleanup();
	void SetName(const char* strName);
	const char*	GetName()		{return m_str_name.c_str();}
	BOOL IsPlayer();
	void SetControl(BOOL bControl);

	void add_effect_tip(const char* str_tip, D3DCOLOR color = RGBA_MAKE(255,0,0,255), float scale=2.0f, FLAG flag = UNIT_EFFECT_FLAG_DAMAGE);

	void query_speek(const char* strSpeek);
	void query_goto(float x, float y);
	void query_melee(Game_Unit* pUnit, uint32 type);
	void query_spell(float x, float y, uint32 uid_spell);

	BOOL Create(ID id, const char *szFile, float x, float y, float h);
	virtual VOID RunAI();
	virtual VOID OnMove();
	virtual VOID OnWait();

	virtual BOOL CanGoto();
	virtual BOOL CanMelee();
	virtual BOOL CanFlinch();
	
	virtual VOID ReleaseSource();
	virtual HRESULT RestoreSource();
	virtual HRESULT	Render();
	virtual HRESULT	Render2();
	virtual VOID OnChangeRenderFlag(BOOL bRender);

	Game_Unit(MainGame* pGame);
	virtual ~Game_Unit();

public:
	void add_magic_effect_specific(STRUCT_EFFECT_SPECIFIC &uae);
	HRESULT update_name();
	void SetSpeekText(const char* strSpeek);
	void add_effect_sound(const char* strSound);
	void add_effect_ani(const char* strAni);
	BOOL CanSpell();
	Game_Unit* get_aim_unit();
	HRESULT update_status();
	VOID CaleDamage(BOOL bTestAct=TRUE);
	void add_effect_specific(STRUCT_EFFECT_SPECIFIC &uae);
	void query_update_state();
			//base
			short			base_level;
			int				base_experience;
			int				base_life;
			int				base_mana;
			short			base_damage;
			short			base_strength;
			short			base_agility;
			short			base_magic;
			//state
			float			life;
			float			mana;
			uint32			status;

			int				count_pk;
			int				count_hunter;
			int				count_die;

			int				exp_level;
			int				exp_level_up;

protected:
	BOOL	m_is_locate_control;			//是否本地处理的单位
	BOOL	m_is_auto_attack;				//是否自动攻击锁定单位
	BOOL	m_is_player;					//是否玩家
	MainGame* m_pGame;						//
	ID		m_aim_unit;						//锁定的目标
	ID		m_lead_unit;					//跟随的目标
	float	m_aim_station_x;				//锁定位置
	float	m_aim_station_y;


	DWORD	m_ai_recover;					//ai的扫描恢复间隔
	DWORD	m_ai_seq;						//ai当前恢复时间

	std::string		m_str_name;				//名字
	CGsTexture		m_tex_status;				//名字纹理
	CGsTexture		m_tex_speeking;			//说话纹理
	float			m_alpha_speeking;


	std::list<GSANI*>				m_list_ani_effect;	
	std::map<std::string, DWORD>	m_map_query_holder;		//命令频繁度抑制器
	std::list<UNIT_EFFECT_TIP*>		m_list_effect_tip;		//效果显示文字
	std::list<STRUCT_EFFECT_SPECIFIC>	m_list_effect_specific;	//攻击效果
	std::list<PARTICLE_MAGIC*>		m_list_particle_magic;
	std::list<CGsSound*>			m_list_sound;
};

#endif // !defined(AFX_GAMEUNIT_H__77FC7259_1184_4B37_9D97_54DC5DAC0FEA__INCLUDED_)

⌨️ 快捷键说明

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