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


C++ CBaseDoor::SetAbsAngles方法代码示例

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


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

示例1: Blocked

void CBaseDoor::Blocked( CBaseEntity *pOther )
{
	CBaseDoor	*pDoor = NULL;


	// Hurt the blocker a little.
	if( GetDamage() )
		pOther->TakeDamage( this, this, GetDamage(), DMG_CRUSH );

	// if a door has a negative wait, it would never come back if blocked,
	// so let it just squash the object to death real fast

	if( m_flWait >= 0 )
	{
		if( m_toggle_state == TS_GOING_DOWN )
		{
			DoorGoUp();
		}
		else
		{
			DoorGoDown();
		}
	}

	// Block all door pieces with the same targetname here.
	if( HasTargetname() )
	{
		CBaseEntity* pTarget = nullptr;
		while( ( pTarget = UTIL_FindEntityByTargetname( pTarget, GetTargetname() ) ) != nullptr )
		{
			if( pTarget != this )
			{
				if( pTarget->ClassnameIs( "func_door" ) || pTarget->ClassnameIs( "func_door_rotating" ) )
				{
					pDoor = static_cast<CBaseDoor*>( pTarget );

					if( pDoor->m_flWait >= 0 )
					{
						//TODO: comparing avel with vel is probably wrong - Solokiller
						if( pDoor->GetAbsVelocity() == GetAbsVelocity() && pDoor->GetAngularVelocity() == GetAbsVelocity() )
						{
							// this is the most hacked, evil, bastardized thing I've ever seen. kjb
							if( pTarget->ClassnameIs( "func_door" ) )
							{// set origin to realign normal doors
								pDoor->SetAbsOrigin( GetAbsOrigin() );
								pDoor->SetAbsVelocity( g_vecZero );// stop!
							}
							else
							{// set angles to realign rotating doors
								pDoor->SetAbsAngles( GetAbsAngles() );
								pDoor->SetAngularVelocity( g_vecZero );
							}
						}

						if( !GetSpawnFlags().Any( SF_DOOR_SILENT ) )
							STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMoving ) );

						if( pDoor->m_toggle_state == TS_GOING_DOWN )
							pDoor->DoorGoUp();
						else
							pDoor->DoorGoDown();
					}
				}
			}
		}
	}
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:67,代码来源:CBaseDoor.cpp


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