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


C++ CHandle::GetAbsAngles方法代码示例

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


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

示例1: KeepTunneling

bool CObjectTunnelTrigger::KeepTunneling( TunnelPlayer *tunnel )
{
	if ( !tunnel || ( tunnel->player == NULL ) )
	{
		return false;
	}

	float remaining = tunnel->teleporttime - gpGlobals->curtime + 0.5f;
	remaining = max( 0.0f, remaining );

	tunnel->iremaining = (int)( remaining );

	if ( !tunnel->exitstarted )
	{
		if ( gpGlobals->curtime > tunnel->fadeintime )
		{
			tunnel->exitstarted = true;
			// Fade user screen to black
			color32 black = {0,0,0,255};
			UTIL_ScreenFade( tunnel->player, black, tunnel->fadetime, 0.0, FFADE_IN | FFADE_PURGE );

			// Move to tunnel exit spot now that we're half-way through teleport
			if ( m_hTunnelExit != NULL )
			{
				tunnel->player->EnableControl( true );
				tunnel->player->RemoveEffects( EF_NODRAW );

				// Change the player to non-solid before the teleport, so the physics system doesn't think he
				// actually moved this distance:
				int OriginalSolidFlags = tunnel->player->GetSolidFlags();
				tunnel->player->AddSolidFlags( FSOLID_NOT_SOLID);

				// Do a placement test to prevent the player from teleporting inside another player, the ground, or just to help
				// prevent badly placed tunnels from causing stuck situations.
				Vector vTarget = m_hTunnelExit->GetAbsOrigin();
				Vector vOriginal = vTarget; 

				if ( !EntityPlacementTest( tunnel->player, vOriginal, vTarget, true ) )
				{
					Warning("Couldn't place entity after tunnel teleport.\n");
				}


				tunnel->player->Teleport( &vTarget /*m_hTunnelExit->GetAbsOrigin()*/, &m_hTunnelExit->GetAbsAngles(), NULL );
				tunnel->player->SnapEyeAngles( m_hTunnelExit->GetAbsAngles() );
				tunnel->player->SetAbsVelocity( vec3_origin );

				// Restore the player's solid flags.
				tunnel->player->SetSolidFlags(OriginalSolidFlags);

			}
		}
// Can't quite do this because the player's weapons are still visible flying across the map even if
//  he is hidden
#if 0
		else if ( gpGlobals->curtime > tunnel->tunnelstarted + tunnel->fadetime )
		{
			float travel_time = tunnel->duration - 2 * tunnel->fadetime;
			if ( travel_time > 0.0f )
			{
				float f = ( gpGlobals->curtime - tunnel->tunnelstarted - tunnel->fadetime  ) / travel_time;
				f = clamp( f, 0.0f, 1.0f );
				if ( m_hTunnelExit != NULL )
				{
					Vector delta = m_hTunnelExit->GetAbsOrigin() - tunnel->startpos;
					Vector currentPos;
					VectorMA( tunnel->startpos, f, delta, currentPos );

					tunnel->player->Teleport( &currentPos, NULL, NULL );
				}
			}
		}
#endif
	}

	if ( tunnel->ilastremaining != tunnel->iremaining &&
		tunnel->needremainigcounter &&
		tunnel->iremaining >= 1 &&
		tunnel->player != NULL )
	{
		// Counter
		ClientPrint( tunnel->player, HUD_PRINTCENTER, UTIL_VarArgs("\nExiting tunnel in %d %s\n", tunnel->iremaining, tunnel->iremaining > 1 ? "seconds" : "second" ) );
	}

	tunnel->ilastremaining = tunnel->iremaining;

	// TODO: Play footstep or some other teleport sounds occasionaly to this player?

	bool done = ( gpGlobals->curtime > tunnel->teleporttime ) ? true : false;
	if ( done )
	{
		color32 black = {0,0,0,255};
		UTIL_ScreenFade( tunnel->player, black, 0.0f, 0.0f, FFADE_IN | FFADE_PURGE );

		tunnel->player->SetMoveType( MOVETYPE_WALK );
		tunnel->player->EnableControl( true );
		tunnel->player->RemoveEffects( EF_NODRAW );
		tunnel->player->RemoveSolidFlags( FSOLID_NOT_SOLID );

		// TODO:  Play an exit sound??
//.........这里部分代码省略.........
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:101,代码来源:tf_obj_tunnel.cpp


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