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


C++ CBaseAnimating::IsOnFire方法代码示例

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


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

示例1: FlameHit

void CASW_Flamer_Projectile::FlameHit( CBaseEntity *pOther, const Vector &vecHitPos, bool bOnlyHurtUnignited )
{
	if (!pOther)
		return;

	bool bHurt = true;

	if ( pOther->m_takedamage != DAMAGE_NO)
	{
		if ( pOther == m_pLastHitEnt )
			return;

		if ( bOnlyHurtUnignited)
		{
			CBaseAnimating* pAnim = dynamic_cast<CBaseAnimating*>(pOther);
			if ( pAnim && pAnim->IsOnFire() )
			{
				bHurt = false;
			}
		}

		if ( bHurt )
		{
			Vector	vecNormalizedVel = GetAbsVelocity();

			ClearMultiDamage();
			VectorNormalize( vecNormalizedVel );

			if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() && pOther->IsNPC() )
			{
				CTakeDamageInfo	dmgInfo( this, m_pGetsCreditedForDamage, m_flDamage, DMG_BURN );
				dmgInfo.AdjustPlayerDamageInflictedForSkillLevel();
				CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, vecHitPos, asw_flamer_force.GetFloat() );
				dmgInfo.SetDamagePosition( vecHitPos );
				dmgInfo.SetWeapon( m_hCreatorWeapon.Get() );

				pOther->TakeDamage(dmgInfo);
			}
			else
			{
				CTakeDamageInfo	dmgInfo( this, m_pGetsCreditedForDamage, m_flDamage, DMG_BURN );
				CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, vecHitPos, asw_flamer_force.GetFloat() );
				dmgInfo.SetDamagePosition( vecHitPos );
				dmgInfo.SetWeapon( m_hCreatorWeapon.Get() );

				pOther->TakeDamage(dmgInfo);
			}

			ApplyMultiDamage();

			// keep going through normal entities?
			m_pLastHitEnt = pOther;
		}

		if ( pOther->Classify() == CLASS_ASW_SHIELDBUG )	// We also want to bounce off shield bugs
		{
			Vector vel = GetAbsVelocity();
			Vector dir = vel;
			VectorNormalize( dir );

			// reflect velocity around normal
			vel = -2.0f * dir + vel;
			vel *= 0.4f;

			// absorb 80% in impact
			SetAbsVelocity( vel );
		}

		return;
	}

	if ( pOther->GetCollisionGroup() == ASW_COLLISION_GROUP_PASSABLE )
		return;

	trace_t	tr;
	tr = BaseClass::GetTouchTrace();

	// See if we struck the world
	if ( pOther->GetMoveType() == MOVETYPE_NONE && !( tr.surface.flags & SURF_SKY ) )
	{
		Vector vel = GetAbsVelocity();
		if ( tr.startsolid )
		{
			if ( !m_inSolid )
			{
				// UNDONE: Do a better contact solution that uses relative velocity?
				vel *= -1.0f; // bounce backwards
				SetAbsVelocity(vel);
			}
			m_inSolid = true;
			return;
		}
		m_inSolid = false;
		if ( tr.DidHit() )
		{
			Vector dir = vel;
			VectorNormalize(dir);

			// reflect velocity around normal
			vel = -2.0f * tr.plane.normal * DotProduct(vel,tr.plane.normal) + vel;
//.........这里部分代码省略.........
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:101,代码来源:asw_flamer_projectile.cpp


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