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


C++ CGrenade::edict方法代码示例

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


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

示例1: GetClassPtr

CGrenade *CGrenade::ShootTimed2(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int iTeam, unsigned short usEvent)
{
	CGrenade *pGrenade = GetClassPtr((CGrenade*)NULL);

	pGrenade->Spawn();

	UTIL_SetOrigin(pGrenade->pev, vecStart);

	pGrenade->pev->velocity  = vecVelocity;
	pGrenade->pev->angles    = pevOwner->angles;
	pGrenade->pev->owner     = ENT(pevOwner);
	pGrenade->m_usEvent      = usEvent;

	pGrenade->SetTouch(&CGrenade::BounceTouch);
	pGrenade->SetThink(&CGrenade::TumbleThink);

	pGrenade->pev->dmgtime   = gpGlobals->time + time;
	pGrenade->pev->nextthink = gpGlobals->time + 0.1;

	pGrenade->pev->sequence  = RANDOM_LONG(3, 6);
	pGrenade->pev->framerate = 1;
	pGrenade->m_bJustBlew    = true;
	pGrenade->pev->gravity   = 0.55;
	pGrenade->pev->friction  = 0.7;
	pGrenade->m_iTeam        = iTeam;

	SET_MODEL(pGrenade->edict(), "models/w_hegrenade.mdl");

	pGrenade->pev->dmg = 100;

	return pGrenade;
}
开发者ID:Chuvi-w,项目名称:CSSDK,代码行数:32,代码来源:ggrenade.cpp

示例2: ShootTimed

CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
{
	CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
	pGrenade->Spawn();

	UTIL_SetOrigin( pGrenade, vecStart );
	pGrenade->SetAbsVelocity( vecVelocity );
	pGrenade->SetLocalAngles( UTIL_VecToAngles( pGrenade->GetAbsVelocity( )));
	pGrenade->pev->owner = ENT( pevOwner );
	
	pGrenade->SetTouch( &CGrenade::BounceTouch );	// Bounce if touched
	
	// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
	// will insert a DANGER sound into the world sound list and delay detonation for one second so that 
	// the grenade explodes after the exact amount of time specified in the call to ShootTimed(). 

	pGrenade->pev->dmgtime = gpGlobals->time + time;
	pGrenade->SetThink( &CGrenade::TumbleThink );
	pGrenade->SetNextThink( 0.1 );

	if( time < 0.1 )
	{
		pGrenade->SetNextThink( 0 );
		pGrenade->SetLocalVelocity( g_vecZero );
	}
		
	pGrenade->pev->sequence = RANDOM_LONG( 3, 6 );
	pGrenade->pev->framerate = 1.0;

	pGrenade->pev->gravity = 0.5;
	pGrenade->pev->friction = 0.8;

	SET_MODEL( pGrenade->edict(), "models/w_grenade.mdl" );
	pGrenade->pev->dmg = 100;

	return pGrenade;
}
开发者ID:FWGS,项目名称:XashXT,代码行数:37,代码来源:ggrenade.cpp


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