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


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

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


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

示例1: GetSkyCameraList

//-----------------------------------------------------------------------------
// Retrives the current skycamera
//-----------------------------------------------------------------------------
CSkyCamera*	GetCurrentSkyCamera()
{
	if (g_hActiveSkybox.Get() == NULL)
	{
		g_hActiveSkybox = GetSkyCameraList();
	}
	return g_hActiveSkybox.Get();
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:11,代码来源:SkyCamera.cpp

示例2: Deactivate

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CGameUI::Deactivate( CBaseEntity *pActivator )
{
	CBasePlayer *pPlayer = m_player;

	AssertMsg(pPlayer, "CGameUI deactivated without a player!");

	if (pPlayer)
	{
		// Re-enable player motion
		if ( FBitSet( m_spawnflags, SF_GAMEUI_FREEZE_PLAYER ) )
		{
			m_player->RemoveFlag( FL_ATCONTROLS );
		}

		// Restore weapons
		if ( FBitSet( m_spawnflags, SF_GAMEUI_HIDE_WEAPON ) )
		{
			// Turn the hud back on
			pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONSELECTION;

			if ( m_hSaveWeapon.Get() )
			{
				m_player->Weapon_Switch( m_hSaveWeapon.Get() );
				m_hSaveWeapon = NULL;
			}

			if ( pPlayer->GetActiveWeapon() )
			{
				pPlayer->GetActiveWeapon()->Deploy();
			}
		}

		// Announce that the player is no longer controlling through us
		m_playerOff.FireOutput( pPlayer, this, 0 );

		// Clear out the axis controls
		m_xaxis.Set( 0, pPlayer, this );
		m_yaxis.Set( 0, pPlayer, this );
		m_attackaxis.Set( 0, pPlayer, this );
		m_attack2axis.Set( 0, pPlayer, this );
		m_nLastButtonState = 0;
		m_player = NULL;
	}
	else
	{
		Warning("%s Deactivate(): I have no player when called by %s!\n", GetEntityName().ToCStr(), pActivator->GetEntityName().ToCStr());
	}
	
	// Stop thinking
	SetNextThink( TICK_NEVER_THINK );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:54,代码来源:game_ui.cpp

示例3:

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
C_BaseCombatCharacter *C_PropCannon::GetPassenger( int nRole )
{
	if ( nRole == VEHICLE_ROLE_DRIVER )
		return m_hPlayer.Get();

	return NULL;
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:10,代码来源:c_vehicle_cannon.cpp

示例4: ConstrainThink

//-----------------------------------------------------------------------------
// Purpose: Check to see if our target has moved beyond our length
//-----------------------------------------------------------------------------
void CHarpoon::ConstrainThink( void )
{
	if ( !GetImpaledTarget() || !m_hLinkedHarpoon.Get() )
		return;

	// Moved too far away?
	float flDistSq = m_hLinkedHarpoon->GetAbsOrigin().DistToSqr( GetImpaledTarget()->GetAbsOrigin() ); 
	if ( flDistSq > m_flConstrainLength )
	{
		// Break the rope
		if ( m_hRope )
		{
			m_hRope->DetachPoint(1);
			m_hRope->DieAtNextRest();
			m_hRope = NULL;
		}

		// If we're impaling a player, remove his movement constraint
		if ( GetImpaledTarget()->IsPlayer() )
		{
			CBaseTFPlayer *pPlayer = (CBaseTFPlayer *)GetImpaledTarget();
			pPlayer->DeactivateMovementConstraint();
		}

		SetThink( NULL );
	}
	else
	{
		SetNextThink( gpGlobals->curtime + 0.1f );
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:34,代码来源:weapon_harpoon.cpp

示例5:

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
C_BaseCombatCharacter *C_PropVehiclePrisonerPod::GetPassenger( int nRole )
{
	if ( nRole == VEHICLE_ROLE_DRIVER )
		return m_hPlayer.Get();

	return NULL;
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:10,代码来源:c_vehicle_prisoner_pod.cpp

示例6: FindByRandom

void CPointEntityFinder::FindByRandom( void )
{
	// TODO: optimize the case where there is no filter
	m_hEntity = NULL;
	CBaseFilter *pFilter = m_hFilter.Get();
	CUtlVector<CBaseEntity *> ValidEnts;

	CBaseEntity *pEntity = gEntList.FirstEnt();
	do	   // note all valid entities.
	{
		if ( pFilter &&  pFilter->PassesFilter( this, pEntity ) )
		{
			ValidEnts.AddToTail( pEntity );
		}

		pEntity = gEntList.NextEnt( pEntity );

	} while ( pEntity );

	// pick one at random
	if ( ValidEnts.Count() != 0 )
	{
		m_hEntity = ValidEnts[ RandomInt( 0, ValidEnts.Count() - 1 )];
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:25,代码来源:point_entity_finder.cpp

示例7:

int	C_QUA_Strider::GetPassengerRole( C_BaseCombatCharacter *pEnt )
{
	if (m_hPlayer.Get() == pEnt)
	{
		return VEHICLE_ROLE_DRIVER;
	}
	return -1;
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:8,代码来源:c_qua_strider.cpp

示例8: Deactivate

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CGameUI::Deactivate( CBaseEntity *pActivator )
{
	CBasePlayer *pPlayer = m_player;

	// If deactivated by the player using me
	if ( pPlayer == pActivator )
	{
		// Re-enable player motion
		if (FBitSet(m_spawnflags, SF_GAMEUI_FREEZE_PLAYER))
		{
			m_player->RemoveFlag( FL_ATCONTROLS );
		}

		// Restore weapons
		if (FBitSet(m_spawnflags, SF_GAMEUI_HIDE_WEAPON))
		{
			// Turn the hud back on
			pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONS;

			if (m_hSaveWeapon.Get())
			{
				m_player->Weapon_Switch( m_hSaveWeapon.Get() );
				m_hSaveWeapon = NULL;
			}

			if ( pPlayer->GetActiveWeapon() )
			{
				pPlayer->GetActiveWeapon()->Deploy();
			}
		}

		m_playerOff.FireOutput( pPlayer, this, 0 );

		// clear out the axis controls
		m_xaxis.Set( 0, pPlayer, this );
		m_yaxis.Set( 0, pPlayer, this );
		m_attackaxis.Set( 0, pPlayer, this );
		m_attack2axis.Set( 0, pPlayer, this );

		m_player = NULL;
		SetNextThink( TICK_NEVER_THINK );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:46,代码来源:game_ui.cpp

示例9: EntityPassesFilter

bool CFuncVPhysicsClip::EntityPassesFilter( CBaseEntity *pOther )
{
	CBaseFilter* pFilter = (CBaseFilter*)(m_hFilter.Get());

	if ( pFilter )
		return pFilter->PassesFilter( this, pOther );

	if ( pOther->GetMoveType() == MOVETYPE_VPHYSICS && pOther->VPhysicsGetObject()->IsMoveable() )
		return true;
	
	return false;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:12,代码来源:bmodels.cpp

示例10: CheckTouching

bool CPhysicsNPCSolver::CheckTouching()
{
	CAI_BaseNPC *pNPC = m_hNPC.Get();
	if ( !pNPC )
		return false;

	CBaseEntity *pPhysicsEnt = m_hEntity.Get();
	if ( !pPhysicsEnt )
		return false;

	IPhysicsObject *pPhysics = pPhysicsEnt->VPhysicsGetObject();
	IPhysicsObject *pNPCPhysics = pNPC->VPhysicsGetObject();
	if ( !pNPCPhysics || !pPhysics )
		return false;

	IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
	bool found = false;
	bool penetrate = false;

	while ( pSnapshot->IsValid() )
	{
		IPhysicsObject *pOther = pSnapshot->GetObject(1);
		if ( pOther == pNPCPhysics )
		{
			found = true;
			if ( IsContactOnNPCHead(pSnapshot, pPhysics, pNPC ) )
			{
				penetrate = true;
				pSnapshot->MarkContactForDelete();
			}
			break;
		}
		pSnapshot->NextFrictionData();
	}
	pSnapshot->DeleteAllMarkedContacts( true );
	pPhysics->DestroyFrictionSnapshot( pSnapshot );

	// if the object is penetrating something, check to see if it's intersecting this NPC
	// if so, go ahead and switch over to penetration solver mode
	if ( !penetrate && (pPhysics->GetGameFlags() & FVPHYSICS_PENETRATING) )
	{
		penetrate = IsIntersecting();
	}

	if ( penetrate )
	{
		pPhysicsEnt->ClearNavIgnore();
		BecomePenetrationSolver();
	}

	return found;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:52,代码来源:physics_npc_solver.cpp

示例11: InputActivate

//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CGameUI::InputActivate( inputdata_t &inputdata )
{
	// If already in use, ignore activatation by others
	if (( m_player.Get() != NULL ) && ( m_player.Get() != inputdata.pActivator ))
	{
		return;
	}

	if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() )
	{
		m_player = (CBasePlayer *)inputdata.pActivator;
		m_playerOn.FireOutput( inputdata.pActivator, this, 0 );

		// Turn the hud off
		SetNextThink( gpGlobals->curtime );

		// Disable player motion
		if (FBitSet(m_spawnflags, SF_GAMEUI_FREEZE_PLAYER))
		{
			m_player->AddFlag( FL_ATCONTROLS );
		}

		if (FBitSet(m_spawnflags, SF_GAMEUI_HIDE_WEAPON))
		{
			m_player->m_Local.m_iHideHUD |= HIDEHUD_WEAPONS;

			if ( m_player->GetActiveWeapon() )
			{
				m_hSaveWeapon = m_player->GetActiveWeapon();

				m_player->GetActiveWeapon()->Holster();
				m_player->ClearActiveWeapon();
				m_player->HideViewModels();
			}
		}
	}

	m_bForceUpdate = true;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:42,代码来源:game_ui.cpp

示例12: FinishAct

//-----------------------------------------------------------------------------
// Purpose: The act has finished
//-----------------------------------------------------------------------------
void CInfoAct::FinishAct( )
{
	if ( g_hCurrentAct.Get() != this )
	{
		DevWarning( 2, "Attempted to finish an act which wasn't started!\n" );
		return;
	}

	ShutdownRespawnTimers();

	switch( m_iWinners)
	{
	case 0:
		m_OnFinishedTeamNone.FireOutput( this, this );
		break;

	case 1:
		m_OnFinishedTeam1.FireOutput( this, this );
		break;

	case 2:
		m_OnFinishedTeam2.FireOutput( this, this );
		break;

	default:
		Assert(0);
		break;
	}

	g_hCurrentAct = NULL;

	// Tell all the clients
	CRelieableBroadcastRecipientFilter filter;
	UserMessageBegin( filter, "ActEnd" );
		WRITE_BYTE( m_iWinners );
	MessageEnd();

	// Am I an intermission?
	if ( HasSpawnFlags( SF_ACT_INTERMISSION ) )
	{
		// Cycle through all players and end the intermission for them
		for ( int i = 1; i <= gpGlobals->maxClients; i++ )
		{
			CBaseTFPlayer *pPlayer = (CBaseTFPlayer*)UTIL_PlayerByIndex( i );
			if ( pPlayer  )
			{
				EndIntermission( pPlayer );
			}
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:54,代码来源:info_act.cpp

示例13: CreateEfficientSpotlight

//-----------------------------------------------------------------------------
// Creates the efficient spotlight 
//-----------------------------------------------------------------------------
void CPointSpotlight::CreateEfficientSpotlight()
{
	if ( m_hSpotlightTarget.Get() != NULL )
		return;

	SpotlightCreate();
	m_vSpotlightCurrentPos = SpotlightCurrentPos();
	m_hSpotlightTarget->SetAbsOrigin( m_vSpotlightCurrentPos );
	m_hSpotlightTarget->m_vSpotlightOrg = GetAbsOrigin();
	VectorSubtract( m_hSpotlightTarget->GetAbsOrigin(), m_hSpotlightTarget->m_vSpotlightOrg, m_hSpotlightTarget->m_vSpotlightDir );
	m_flSpotlightCurLength = VectorNormalize( m_hSpotlightTarget->m_vSpotlightDir );
	m_hSpotlightTarget->SetMoveType( MOVETYPE_NONE );
	ComputeRenderInfo();
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:17,代码来源:point_spotlight.cpp

示例14: SetOwner

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void COrder::SetOwner( CBaseTFPlayer *pPlayer )
{
	// Null out our m_hOwningPlayer so we don't recurse infinitely.
	CHandle<CBaseTFPlayer> hPlayer = m_hOwningPlayer;
	m_hOwningPlayer = 0;

	if ( hPlayer.Get() && (hPlayer != pPlayer) )
	{
		Assert( hPlayer->GetOrder() == this );
		hPlayer->SetOrder( NULL );	
	}
	
	m_hOwningPlayer = pPlayer;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:17,代码来源:orders.cpp

示例15: CC_Test_EHandle

	// The test runs this command.
	void CC_Test_EHandle()
	{
		if ( g_HandleTest.Get() )
		{
			g_HandleTest->m_bSendHandle = !g_HandleTest->m_bSendHandle;
		}
		else
		{
			CHandleTest *pHolder = CREATE_ENTITY( CHandleTest, "handle_test" );
			pHolder->m_Handle = CREATE_ENTITY( CHandleDummy, "handle_dummy" );
			pHolder->Spawn();
			g_HandleTest = pHolder;
			Msg( "Created EHANDLE test entity. Run this command again to transmit the second ent.\n" );
		}
	}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:16,代码来源:test_ehandle.cpp


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