// reloadActiveWeapon // reload weapon void CWeaponComponent::reloadActiveWeapon(bool b) { if ( m_activeWeapon ) { CGameObject *pObj = m_activeWeapon->m_obj; CGunComponent* gun = (CGunComponent*)pObj->getComponent(CGameComponent::GunComponent); if ( gun ) gun->reload(b); } }
// needReloadActiveWeapon // check to reload active weapon bool CWeaponComponent::needReloadActiveWeapon() { if ( m_activeWeapon ) { CGameObject *pObj = m_activeWeapon->m_obj; CGunComponent* gun = (CGunComponent*)pObj->getComponent(CGameComponent::GunComponent); if ( gun ) return gun->needReload(); } return false; }