コード例 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayer_Missile::InputActivate( inputdata_t &inputdata )
{
	// Make sure not already active
	if (m_bActive)
	{
		return;
	}

	BaseClass::InputActivate( inputdata );

	Vector origin = GetLocalOrigin();
	origin.z	+= 50;
	SetLocalOrigin( origin );
	RemoveSolidFlags( FSOLID_NOT_SOLID );
	Relink();

	// Using player angles to determine turning.  Initailze to 0,0,0
	CHL2_Player*	pPlayer		= (CHL2_Player*)UTIL_PlayerByIndex( 1 );

	Assert( pPlayer );

	pPlayer->SetLocalAngles( vec3_angle );	// Note: Set GetLocalAngles(), not pl.v_angle
	pPlayer->SnapEyeAngles( vec3_angle );				// Force reset
	pPlayer->SetFOV( 100 );

	engine->SetView( pPlayer->edict(), edict() );

	m_flStatic					= 0;
	SetThink(Launch);
	SetNextThink( gpGlobals->curtime + m_flLaunchDelay );
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayer_Missile::ControlDeactivate( void )
{
	BaseClass::ControlDeactivate();

	CHL2_Player*	pPlayer		= (CHL2_Player*)UTIL_PlayerByIndex( 1 );

	Assert( pPlayer );

	engine->SetView( pPlayer->edict(), pPlayer->edict() );

	pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONS;

	SetAbsVelocity( vec3_origin );
	SetLocalAngles( m_vSpawnAng );
	SetLocalOrigin( m_vSpawnPos );
	m_fEffects		|= EF_NODRAW;
	Relink();
}