www.pudn.com > 林海血原源代码.zip > AmmoManager.cpp


// AmmoManager.cpp: implementation of the CAmmoManager class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "AmmoManager.h" 
#include "texture.h" 
#include "math.h" 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
CAmmoManager::CAmmoManager() 
{ 
   
} 
 
CAmmoManager::~CAmmoManager() 
{ 
} 
bool CAmmoManager::InitAmmoManager() 
{ 
    CTexture cTexture; 
    if(!cTexture.MakeAlphaTextureBind("texture/smoke.bmp",    &texid))return false; 
     return true; 
} 
void CAmmoManager::LaunchRocket(VERTEX  startPos,float rotx,float roty ) 
{ 
    NORMAL direction; 
    direction.nx=-cosf(rotx*0.0174533f)*sinf(roty*0.0174533f); 
    direction.ny=-sinf(rotx*0.0174533f); 
    direction.nz=-cosf(rotx*0.0174533f)*cosf(roty*0.0174533f); 
 
	LaunchRocket(startPos,rotx,roty ,direction); 
 
} 
void  CAmmoManager::LaunchRocket(VERTEX  startPos,float rotx,float roty ,NORMAL normal) 
{ 
	int  index=0; 
	bool bSuccess=false; 
	while(index0) //flying 
		{ 
            m_rocketList[i].UpdateRocket(); 
			m_rocketList[i].DrawRocket(); 
		} 
	} 
} 
void  CAmmoManager::DrawAmmoManager() 
{ 
    m_rifle.DrawRifleShot(); 
} 
////////////////////////////////////////// 
//////////////////////////////////////// 
///////////////////////////////////////////// 
void CAmmoManager::RifleFire(VERTEX  startPos,float rotx,float roty ) 
{ 
    NORMAL direction; 
    direction.nx=-cosf(rotx*0.0174533f)*sinf(roty*0.0174533f); 
    direction.ny=-sinf(rotx*0.0174533f); 
    direction.nz=-cosf(rotx*0.0174533f)*cosf(roty*0.0174533f); 
 
	m_rifle.LunchBullet(1,startPos,rotx,roty , direction); 
 
}