当前位置: 首页>>代码示例>>C++>>正文


C++ CEntityAlive类代码示例

本文整理汇总了C++中CEntityAlive的典型用法代码示例。如果您正苦于以下问题:C++ CEntityAlive类的具体用法?C++ CEntityAlive怎么用?C++ CEntityAlive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CEntityAlive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: motion

MotionID death_anims::motion ( CEntityAlive& ea, const SHit& H, float &angle ) const
{
	angle = 0;
	if( anims.empty( ) )
	{
#ifdef	DEBUG
		if( death_anim_debug )
			Msg(" death anims: obj: %s no death motions loaded ", ea.cName().c_str() );
#endif
		return rnd_anims.motion();
	}
	
	MotionID m;
	xr_vector<type_motion*>::const_iterator i = anims.begin(), e = anims.end();
	for( ; e!=i; ++i )
		if((*i)->predicate( ea, H, m, angle ) && m.valid() )
			return m;

#ifdef	DEBUG
		if( death_anim_debug )
			Msg(" death anims: obj: %s no conditions evaluated  returns random ", ea.cName().c_str() );
#endif
	angle = 0;
	return rnd_anims.motion();
}
开发者ID:2asoft,项目名称:xray,代码行数:25,代码来源:death_anims.cpp

示例2: HACK_TERRIBLE_DONOT_COLLIDE_ON_SPAWN

bool HACK_TERRIBLE_DONOT_COLLIDE_ON_SPAWN( CEntityAlive &ea )
{
	if( pSettings->line_exist( ea.cNameSect().c_str(), "hack_terrible_donot_collide_on_spawn") &&
		pSettings->r_bool( ea.cNameSect().c_str(), "hack_terrible_donot_collide_on_spawn") 
		) return true;
	return false;
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:CharacterPhysicsSupport.cpp

示例3: feel_vision_isRelevant

BOOL CAI_Rat::feel_vision_isRelevant(CObject* O)
{
	CEntityAlive* E = smart_cast<CEntityAlive*> (O);
	if (!E) return FALSE;
	if ((E->g_Team() == g_Team()) && (E->g_Alive())) return FALSE;
	return TRUE;
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:ai_rat_feel.cpp

示例4: feel_touch_contact

BOOL CBastArtefact::feel_touch_contact(CObject* O) 
{
	CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(O);

	if(pEntityAlive && pEntityAlive->g_Alive()) 
		return TRUE;
	else
		return FALSE;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:BastArtifact.cpp

示例5: feel_touch_new

void CBastArtefact::feel_touch_new(CObject* O) 
{
	CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(O);

	if(pEntityAlive && pEntityAlive->g_Alive()) 
	{
		m_AliveList.push_back(pEntityAlive);
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:BastArtifact.cpp

示例6: Update

void CUIInventoryWnd::Update()
{
	if(m_b_need_reinit)
		InitInventory					();


	CEntityAlive *pEntityAlive			= smart_cast<CEntityAlive*>(Level().CurrentEntity());

	if(pEntityAlive) 
	{
		float v = pEntityAlive->conditions().GetHealth()*100.0f;
		UIProgressBarHealth.SetProgressPos		(v);

		v = pEntityAlive->conditions().GetPsyHealth()*100.0f;
		UIProgressBarPsyHealth.SetProgressPos	(v);

		v = pEntityAlive->conditions().GetRadiation()*100.0f;
		UIProgressBarRadiation.SetProgressPos	(v);
		
#ifdef INV_NEW_SLOTS_SYSTEM
		if (GameID() == GAME_SINGLE){
			CActor*	m_pActor = smart_cast<CActor*>(Level().CurrentViewEntity());
			
			v =(m_pActor->conditions().GetSatiety())*100.0f;
			UIProgressBarSatiety.SetProgressPos	(v);
		}
#endif

		CInventoryOwner* pOurInvOwner	= smart_cast<CInventoryOwner*>(pEntityAlive);
		u32 _money						= 0;

		if (GameID() != GAME_SINGLE){
			game_PlayerState* ps = Game().GetPlayerByGameID(pEntityAlive->ID());
			if (ps){
				UIProgressBarRank.SetProgressPos(ps->experience_D*100);
				_money							= ps->money_for_round;
			}
		}else
		{
			_money							= pOurInvOwner->get_money();
		}
		// update money
		string64						sMoney;
		//red_virus
		sprintf_s						(sMoney,"%d %s", _money, *CStringTable().translate("ui_st_money_regional"));
		UIMoneyWnd.SetText				(sMoney);

		// update outfit parameters
		CCustomOutfit* outfit			= smart_cast<CCustomOutfit*>(pOurInvOwner->inventory().m_slots[OUTFIT_SLOT].m_pIItem);		
		UIOutfitInfo.Update				(outfit);		
	}

	UIStaticTimeString.SetText(*InventoryUtilities::GetGameTimeAsString(InventoryUtilities::etpTimeToMinutes));

	CUIWindow::Update					();
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例7: Actor

void CCameraLook2::Update(Fvector& point, Fvector&)
{
	if(!m_locked_enemy)
	{//autoaim
		if( pInput->iGetAsyncKeyState(cam_dik) )
		{
			const CVisualMemoryManager::VISIBLES& vVisibles = Actor()->memory().visual().objects();
			CVisualMemoryManager::VISIBLES::const_iterator v_it = vVisibles.begin();
			float _nearest_dst	= flt_max;

			for (; v_it!=vVisibles.end(); ++v_it)
			{
				const CObject*	_object_			= (*v_it).m_object;
				if (!Actor()->memory().visual().visible_now(smart_cast<const CGameObject*>(_object_)))	continue;

				CObject* object_ = const_cast<CObject*>(_object_);
				

				CEntityAlive*	EA					= smart_cast<CEntityAlive*>(object_);
				if(!EA || !EA->g_Alive())			continue;
				
				float d = object_->Position().distance_to_xz(Actor()->Position());
				if( !m_locked_enemy || d<_nearest_dst)
				{
					m_locked_enemy	= object_;
					_nearest_dst	= d;
				}
			}
//.			if(m_locked_enemy) Msg("enemy is %s", *m_locked_enemy->cNameSect() );
		}
	}else
	{
		if( !pInput->iGetAsyncKeyState(cam_dik) ){
			m_locked_enemy	= NULL;
//.			Msg				("enemy is NILL");
		}
	}

	if(m_locked_enemy)
		UpdateAutoAim	();


	Fmatrix mR;
	mR.setHPB						(-yaw,-pitch,-roll);

	vDirection.set					(mR.k);
	vNormal.set						(mR.j);

	Fmatrix							a_xform;
	a_xform.setXYZ					(0, -yaw, 0);
	a_xform.translate_over			(point);
	Fvector _off					= m_cam_offset;
	a_xform.transform_tiny			(_off);
	vPosition.set					(_off);
}
开发者ID:2asoft,项目名称:xray,代码行数:55,代码来源:cameralook.cpp

示例8: VERIFY

void CInventoryOwner::SetRank			(CHARACTER_RANK_VALUE rank)
{
	CEntityAlive* EA					= smart_cast<CEntityAlive*>(this); VERIFY(EA);
	CSE_Abstract* e_entity				= ai().alife().objects().object(EA->ID(), false);
	if(!e_entity) return;
	CSE_ALifeTraderAbstract* trader		= smart_cast<CSE_ALifeTraderAbstract*>(e_entity);
	if(!trader) return;

	CharacterInfo().m_CurrentRank.set(rank);
	trader->m_rank  = rank;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9:

void CPda::UpdateActiveContacts	()
{
	m_active_contacts.clear_not_free();
	xr_vector<CObject*>::iterator it= feel_touch.begin();
	for(;it!=feel_touch.end();++it){
		CEntityAlive* pEA = smart_cast<CEntityAlive*>(*it);
		if(!!pEA->g_Alive() && !pEA->cast_base_monster())
		{
			m_active_contacts.push_back(*it);
		}
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,代码来源:PDA.cpp

示例10: AffectPull

void CBaseGraviZone::AffectPull(CPhysicsShellHolder* GO,const Fvector& throw_in_dir,float dist)
{
	CEntityAlive* EA = smart_cast<CEntityAlive*>(GO);	
	if(EA && EA->g_Alive())
	{
		AffectPullAlife(EA,throw_in_dir,dist);
	}
	else if(GO && GO->PPhysicsShell())
	{
		AffectPullDead(GO,throw_in_dir,dist);
	}
}
开发者ID:zcaliptium,项目名称:xray-16,代码行数:12,代码来源:ZoneGravi.cpp

示例11: H_Parent

BOOL CWeapon::ParentIsActor	()
{
	CObject* O			= H_Parent();
	if (!O)
		return FALSE;

	CEntityAlive* EA	= smart_cast<CEntityAlive*>(O);
	if (!EA)
		return FALSE;

	return EA->cast_actor()!=0;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,代码来源:Weapon.cpp

示例12: predicate

	bool predicate( CEntityAlive& ea, const SHit& H, MotionID &m, float &angle ) const
	{
		m = MotionID();
		if( H.initiator() !=  Level().CurrentControlEntity())
			return false;
		VERIFY( ea.Visual( ) );
		IKinematics *K = ea.Visual()->dcast_PKinematics();
		VERIFY( K );
		if( is_bone_head( *K, H.bone() ) )
		{
			edirection dr = dir( ea, H, angle );
			m = motion( dr );
			type_motion_diagnostic( " type_motion3: 4.	’едшот (по веро¤тности), кроме 5 (4)", dr, ea, H, m );
			return true;
		}
		return false;
	}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:17,代码来源:death_anims_predicates.cpp

示例13: UpdateXForm

void CArtefact::UpdateXForm()
{
	if (Device.dwFrame!=dwXF_Frame)
	{
		dwXF_Frame			= Device.dwFrame;

		if (0==H_Parent())	return;

		// Get access to entity and its visual
		CEntityAlive*		E		= smart_cast<CEntityAlive*>(H_Parent());
        
		if(!E)				return	;

		const CInventoryOwner	*parent = smart_cast<const CInventoryOwner*>(E);
		if (parent && parent->use_simplified_visual())
			return;

		VERIFY				(E);
		IKinematics*		V		= smart_cast<IKinematics*>	(E->Visual());
		VERIFY				(V);
		if(CAttachableItem::enabled())
			return;

		// Get matrices
		int					boneL = -1, boneR = -1, boneR2 = -1;
		E->g_WeaponBones	(boneL,boneR,boneR2);
		if (boneR == -1)	return;

		boneL = boneR2;

		V->CalculateBones	();
		Fmatrix& mL			= V->LL_GetTransform(u16(boneL));
		Fmatrix& mR			= V->LL_GetTransform(u16(boneR));

		// Calculate
		Fmatrix				mRes;
		Fvector				R,D,N;
		D.sub				(mL.c,mR.c);	D.normalize_safe();
		R.crossproduct		(mR.j,D);		R.normalize_safe();
		N.crossproduct		(D,R);			N.normalize_safe();
		mRes.set			(R,N,D,mR.c);
		mRes.mulA_43		(E->XFORM());
//		UpdatePosition		(mRes);
		XFORM().mul			(mRes,offset());
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:46,代码来源:Artefact.cpp

示例14: feel_sound_new

void CBaseMonster::feel_sound_new(CObject* who, int eType, CSound_UserDataPtr user_data, const Fvector &Position, float power)
{
	if (!g_Alive())		return;

	// ignore my sounds
	if (this == who)	return;

	if (user_data)
		user_data->accept	(sound_user_data_visitor());

	// ignore unknown sounds
	if (eType == 0xffffffff) return;

	// ignore distant sounds
	Fvector center;
	Center	(center);
	float dist	= center.distance_to(Position);
	if (dist > db().m_max_hear_dist)	return;

	// ignore sounds if not from enemies and not help sounds
	CEntityAlive* entity = smart_cast<CEntityAlive*> (who);

	// ignore sound if enemy drop a weapon on death
	if (!entity && ((eType & SOUND_TYPE_ITEM_HIDING) == SOUND_TYPE_ITEM_HIDING)) return;

	if (entity && (!EnemyMan.is_enemy(entity))) {
		SoundMemory.check_help_sound(eType, entity->ai_location().level_vertex_id());
		return;
	}
	
	if ((eType & SOUND_TYPE_WEAPON_SHOOTING) == SOUND_TYPE_WEAPON_SHOOTING) power = 1.f;

	if (((eType & SOUND_TYPE_WEAPON_BULLET_HIT) == SOUND_TYPE_WEAPON_BULLET_HIT) && (dist < 2.f)) 
		HitMemory.add_hit(who,eSideFront);

	// execute callback
	sound_callback	(who,eType,Position,power);
	
	// register in sound memory
	if (power >= db().m_fSoundThreshold) {
		SoundMemory.HearSound(who,eType,Position,power,Device.dwTimeGlobal);
 	}
}
开发者ID:BeaconDev,项目名称:xray-16,代码行数:43,代码来源:base_monster_feel.cpp

示例15: check_attack_jump

//////////////////////////////////////////////////////////////////////////
// Services
//////////////////////////////////////////////////////////////////////////
void CControlManagerCustom::check_attack_jump()
{
	if (!m_object->EnemyMan.get_enemy())	return;
	if (m_object->GetScriptControl())		return;
	if (!m_object->check_start_conditions(ControlCom::eControlJump)) return;
	if (!m_object->EnemyMan.see_enemy_now())return;
	
	CEntityAlive *target = const_cast<CEntityAlive*>(m_object->EnemyMan.get_enemy());
	if (!m_jump->can_jump(target)) return;

	if (m_man->check_start_conditions(ControlCom::eControlJump)) {

		m_jump->setup_data().flags.set			(SControlJumpData::ePrepareSkip, false);
		m_jump->setup_data().target_object		= target;
		m_jump->setup_data().target_position	= target->Position();

		jump(m_jump->setup_data());
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:22,代码来源:control_manager_custom.cpp


注:本文中的CEntityAlive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。