www.pudn.com > 3D_Tank.rar > GameObject.h


#ifndef __GAMEOBJECT_H__ 
#define __GAMEOBJECT_H__ 
 
#include  
#include  
#include "ComPtr.h" 
#include "Error.h" 
#include "Arithmetic.h" 
#include "Camera.h" 
#include "Particle.h" 
#include "Sound.h" 
 
class Tank 
{ 
public: 
	Tank(); 
	~Tank(); 
	VOID InitObject(const CComPtr &device); 
 
	D3DXVECTOR3 & GetMoveDirection(D3DXVECTOR3 *direction); 
	D3DXVECTOR3 & GetPosition(D3DXVECTOR3 *position); 
	float GetYaw(); 
	 
    VOID SetPosition(float x, float y, float z); 
	VOID SetPitchRoll(float pitch, float roll); 
	VOID SetPositionHeight(float height); 
	VOID SetCamera(CCamera *camera); 
	VOID SetParticle(CParticleSystem *particle); 
	VOID SetSoundPlayer(CSoundSet *sound); 
	VOID ChangeMode(); 
	 
	VOID Render(); 
	VOID CameraUpdate(); 
 
	VOID Walk(float length); 
	VOID BodyYaw(float angle); 
	VOID GunYaw(float angle); 
	VOID GunPitch(float angle); 
	VOID Fire(); 
	VOID TimeElapse(float time); 
 
private: 
	VOID PrepareBodyRenderState(); 
	VOID ResetRenderState(); 
	VOID PrepareConsoleRenderState(); 
	VOID PrepareGunRenderState(); 
 
	D3DXVECTOR3 m_vPosition; 
	D3DXVECTOR3 m_vMoveDirection; 
 
	float		m_fPitch;		//坦克的俯仰角度 
	float		m_fRoll;		//坦克的翻滚角度 
	float		m_fYaw;			//坦克的偏航角度 
	float		m_fGunPitch;	//炮管的俯仰角度 
	float		m_fGunYaw;		//炮管的偏航角度 
 
	CComPtr	m_pDevice;		//D3D设备接口 
	CComPtr	m_pTexture; 
    CComPtr			m_pBodyMesh;	//坦克主干的MESH 
	std::vector	m_vecBodyMaterial; 
	CComPtr			m_pConsoleMesh;	//坦克炮身的MESH 
	std::vector	m_vecConsoleMaterial; 
	CComPtr			m_pGunMesh;		//坦克炮管的MESH 
	std::vector	m_vecGunMaterial; 
	CCamera						*m_pCamera;		//摄像机指针 
	CParticleSystem				*m_pParticle;	//粒子系统指针 
	CSoundSet					*m_pSound; 
	 
	//游戏逻辑相关 
	BOOL		m_bAttackMode;		//射击模式标志 
	float		m_fFireColdTime; 
	float		m_fChangeModeColdTime; 
}; 
#endif     //GameObject