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


C++ COutputEvent类代码示例

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


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

示例1: FindTarget

void CTFOClassnameFinder::FindTarget( inputdata_t &inputdata )
{
	bool bFound = false;
	CBaseEntity *pMyFoundEnt = NULL;

	// Try classname
	pMyFoundEnt = gEntList.FindEntityByClassname( NULL, szTarget.ToCStr() );
	while ( pMyFoundEnt )
	{
		if ( !strcmp( pMyFoundEnt->GetClassname(), szTarget.ToCStr() ) )
		{
			pFoundTarget.FireOutput( this, this );
			bFound = true;
			break;
		}

		pMyFoundEnt = gEntList.FindEntityByClassname( pMyFoundEnt, szTarget.ToCStr() );
	}

	if ( bFound ) 
		return;

	// Try the actual name
	pMyFoundEnt = gEntList.FindEntityByName( NULL, szTarget.ToCStr() );
	while ( pMyFoundEnt )
	{
		if ( !strcmp( pMyFoundEnt->GetEntityName().ToCStr(), szTarget.ToCStr() ) )
		{
			pFoundTarget.FireOutput( this, this );
			break;
		}

		pMyFoundEnt = gEntList.FindEntityByName( pMyFoundEnt, szTarget.ToCStr() );
	}
}
开发者ID:BerntA,项目名称:tfo-code,代码行数:35,代码来源:tfo_classname_finder.cpp

示例2: TriggerThink

//-----------------------------------------------------------------------------
// Purpose: Every second, check total stress and fire an output if we have reached 
//			our threshold. If the stress is relieved below our threshold, fire a different output.
//-----------------------------------------------------------------------------
void CWeightButton::TriggerThink( void )
{
	vphysics_objectstress_t vpobj_StressOut;
	IPhysicsObject* pMyPhysics = VPhysicsGetObject();

	if ( !pMyPhysics )
	{
		SetNextThink( TICK_NEVER_THINK );
		return;
	}

 	float fStress = CalculateObjectStress( pMyPhysics, this, &vpobj_StressOut );

//	fStress = vpobj_StressOut.receivedStress;

	if ( fStress > m_fStressToActivate && !m_bHasBeenPressed )
	{
		m_OnPressed.FireOutput( this, this );
		m_bHasBeenPressed = true;
	}
	else if ( fStress < m_fStressToActivate && m_bHasBeenPressed )
	{
		m_OnReleased.FireOutput( this, this );
		m_bHasBeenPressed = false;
	}

	// think every tick
	SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:33,代码来源:weight_button.cpp

示例3: Think

//-----------------------------------------------------------------------------
// Purpose: Called shortly after level spawn. Checks the global state and fires
//			targets if the global state is set or if there is not global state
//			to check.
//-----------------------------------------------------------------------------
void CLogicAuto::Think(void)
{
	if (!m_globalstate || GlobalEntity_GetState(m_globalstate) == GLOBAL_ON)
	{
		if (gpGlobals->eLoadType == MapLoad_Transition)
		{
			m_OnMapTransition.FireOutput(NULL, this);
		}
		else if (gpGlobals->eLoadType == MapLoad_NewGame)
		{
			m_OnNewGame.FireOutput(NULL, this);
		}
		else if (gpGlobals->eLoadType == MapLoad_LoadGame)
		{
			m_OnLoadGame.FireOutput(NULL, this);
		}
		else if (gpGlobals->eLoadType == MapLoad_Background)
		{
			m_OnBackgroundMap.FireOutput(NULL, this);
		}

		m_OnMapSpawn.FireOutput(NULL, this);

		if (m_spawnflags & SF_AUTO_FIREONCE)
		{
			UTIL_Remove(this);
		}
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:34,代码来源:logicauto.cpp

示例4: LauncherThink

//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CNPC_Launcher::LauncherThink( void )
{
	if (gpGlobals->curtime > m_flNextAttack)
	{
		// If enemy was set, fire at enemy
		if (GetEnemy())
		{
			LaunchGrenade(GetEnemy());
			m_OnLaunch.FireOutput(GetEnemy(), this);
			m_flNextAttack = gpGlobals->curtime + m_nLaunchDelay;
		}
		// Otherwise look for enemy to fire at
		else
		{
			GetSenses()->Look((int)m_flMaxAttackDist);
			CBaseEntity* pBestEnemy = BestEnemy();

			if (pBestEnemy)
			{
				LaunchGrenade(pBestEnemy);
				m_OnLaunch.FireOutput(pBestEnemy, this);
				m_flNextAttack = gpGlobals->curtime + m_nLaunchDelay;
			}
		}
	}
	SetNextThink( gpGlobals->curtime + 0.1f );
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:30,代码来源:npc_launcher.cpp

示例5: Event_Killed

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : &info - 
//-----------------------------------------------------------------------------
void CAntlionGrub::Event_Killed( const CTakeDamageInfo &info )
{
	// Fire our output only if the player is the one that killed us
	if ( info.GetAttacker() && info.GetAttacker()->IsPlayer() )
	{
		m_OnDeathByPlayer.FireOutput( info.GetAttacker(), info.GetAttacker() );
	}

	m_OnDeath.FireOutput( info.GetAttacker(), info.GetAttacker() );
	SendOnKilledGameEvent( info );

	// Crush and crowbar damage hurt us more than others
	bool bSquashed = ( info.GetDamageType() & (DMG_CRUSH|DMG_CLUB)) ? true : false;
	Squash( info.GetAttacker(), false, bSquashed );

	m_takedamage = DAMAGE_NO;

	if ( sk_grubnugget_enabled.GetBool() )
	{
		CreateNugget();
	}

	// Go away
	SetThink( &CBaseEntity::SUB_Remove );
	SetNextThink( gpGlobals->curtime + 0.1f );

	// we deliberately do not call BaseClass::EventKilled
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:32,代码来源:npc_antliongrub.cpp

示例6: DissolveThink

//-----------------------------------------------------------------------------
// Purpose: Dissolve all weapons within our volume
//-----------------------------------------------------------------------------
void CTriggerWeaponDissolve::DissolveThink( void )
{
	int	numWeapons = m_pWeapons.Count();

	// Dissolve all the items within the volume
	for ( int i = 0; i < numWeapons; i++ )
	{
		CBaseCombatWeapon *pWeapon = m_pWeapons[i];
		Vector vecConduit = GetConduitPoint( pWeapon );
		
		// The physcannon upgrades when this happens
		if ( FClassnameIs( pWeapon, "weapon_physcannon" ) )
		{
			// This must be the last weapon for us to care
			if ( numWeapons > 1 )
				continue;

			//FIXME: Make them do this on a stagger!

			// All conduits send power to the weapon
			for ( int i = 0; i < m_pConduitPoints.Count(); i++ )
			{
				CreateBeam( m_pConduitPoints[i]->GetAbsOrigin(), pWeapon, 4.0f );
			}

			PhysCannonBeginUpgrade( pWeapon );
			m_OnChargingPhyscannon.FireOutput( this, this );

			EmitSound( "WeaponDissolve.Beam" );

			// We're done
			m_pWeapons.Purge();
			m_pConduitPoints.Purge();
			SetContextThink( NULL, 0, s_pDissolveThinkContext );
			return;
		}

		// Randomly dissolve them all
		float flLifetime = random->RandomFloat( 2.5f, 4.0f );
		CreateBeam( vecConduit, pWeapon, flLifetime );
		pWeapon->Dissolve( NULL, gpGlobals->curtime + ( 3.0f - flLifetime ), false );

		m_OnDissolveWeapon.FireOutput( this, this );

		CPASAttenuationFilter filter( pWeapon );
		EmitSound( filter, pWeapon->entindex(), "WeaponDissolve.Dissolve" );
		
		// Beam looping sound
		EmitSound( "WeaponDissolve.Beam" );

		m_pWeapons.Remove( i );
		SetContextThink( &CTriggerWeaponDissolve::DissolveThink, gpGlobals->curtime + random->RandomFloat( 0.5f, 1.5f ), s_pDissolveThinkContext );
		return;
	}

	SetContextThink( &CTriggerWeaponDissolve::DissolveThink, gpGlobals->curtime + 0.1f, s_pDissolveThinkContext );
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:60,代码来源:hl2_triggers.cpp

示例7: InputTest

//-----------------------------------------------------------------------------
// Purpose: Input handler for forcing an instantaneous test of the condition.
//-----------------------------------------------------------------------------
void CPointAngleSensor::InputTest(inputdata_t &inputdata)
{
	if (IsFacingWithinTolerance(m_hTargetEntity, m_hLookAtEntity, m_flDotTolerance))
	{
		m_OnFacingLookat.FireOutput(inputdata.pActivator, this);
	}
	else
	{
		m_OnNotFacingLookat.FireOutput(inputdata.pActivator, this);
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:14,代码来源:pointanglesensor.cpp

示例8: HandleAnimEvent

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehiclePrisonerPod::HandleAnimEvent( animevent_t *pEvent )
{
	if ( pEvent->event == AE_POD_OPEN )
	{
		m_OnOpen.FireOutput( this, this );
		m_bLocked = false;
	}
	else if ( pEvent->event == AE_POD_CLOSE )
	{
		m_OnClose.FireOutput( this, this );
		m_bLocked = true;
	}
}
开发者ID:SCell555,项目名称:bisonours-party,代码行数:16,代码来源:vehicle_prisoner_pod.cpp

示例9: HandleAnimEvent

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleChoreoGeneric::HandleAnimEvent( animevent_t *pEvent )
{
	if ( pEvent->event == AE_CHOREO_VEHICLE_OPEN )
	{
		m_OnOpen.FireOutput( this, this );
		m_bLocked = false;
	}
	else if ( pEvent->event == AE_CHOREO_VEHICLE_CLOSE )
	{
		m_OnClose.FireOutput( this, this );
		m_bLocked = true;
	}
}
开发者ID:P1x3lF3v3r,项目名称:Estranged-Act-1,代码行数:16,代码来源:vehicle_choreo_generic.cpp

示例10: Think

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CCommentaryAuto::Think(void)
{
	if ( g_CommentarySystem.CommentaryWasEnabledMidGame() )
	{
		m_OnCommentaryMidGame.FireOutput(NULL, this);
	}
	else
	{
		m_OnCommentaryNewGame.FireOutput(NULL, this);
	}

	UTIL_Remove(this);
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:16,代码来源:commentarysystem.cpp

示例11: VPhysicsCollision

//-----------------------------------------------------------------------------
// Purpose: Handle a collision using our special behavior
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
{
	// Find out what we hit.
	// Don't do anything special if we're already attached to a strider.
	CBaseEntity *pVictim = pEvent->pEntities[!index];
	if ( pVictim == NULL || m_pConstraint != NULL )
	{
		BaseClass::VPhysicsCollision( index, pEvent );
		return;
	}

	// Don't attach if we're being held by the player
	if ( VPhysicsGetObject()->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
	{
		BaseClass::VPhysicsCollision( index, pEvent );
		return;
	}

	// Save off the speed of the object
	m_flCollisionSpeedSqr = ( pEvent->preVelocity[ index ] ).LengthSqr();

	// Break if we hit the world while going fast enough.
	// Launched duds detonate if they hit the world at any speed.
	if ( pVictim->IsWorld() && ( ( m_bDud && m_bLaunched ) || m_flCollisionSpeedSqr > Square( 500 ) ) )
	{
		m_OnShatter.FireOutput( this, this );
		Shatter( pVictim );
		return;
	}

	// We'll handle this later in our touch call
	if ( ShouldStickToEntity( pVictim ) )
		return;

	// Determine if we should shatter
	CBaseEntity *pOwnerEntity = pVictim->GetOwnerEntity();
	bool bVictimIsStrider = ( ( pOwnerEntity != NULL ) && FClassnameIs( pOwnerEntity, "npc_strider" ) );

	// Break if we hit anything other than a strider while going fast enough.
	// Launched duds detonate if they hit anything other than a strider any speed.
	if ( ( bVictimIsStrider == false ) && ( ( m_bDud && m_bLaunched ) || m_flCollisionSpeedSqr > Square( 500 ) ) )
	{
		m_OnShatter.FireOutput( this, this );
		Shatter( pVictim );
		return;
	}

	// Just bounce
	BaseClass::VPhysicsCollision( index, pEvent );
}
开发者ID:FooGames,项目名称:SecobMod,代码行数:53,代码来源:weapon_striderbuster.cpp

示例12: Detonate

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::Detonate( void )
{
	CBaseEntity *pVictim = GetOwnerEntity();
	if ( !m_bDud && pVictim )
	{
		// Kill the strider (with magic effect)
		CBasePlayer *pPlayer = AI_GetSinglePlayer();
		CTakeDamageInfo info( pPlayer, this, RandomVector( -100.0f, 100.0f ), GetAbsOrigin(), pVictim->GetHealth(), DMG_GENERIC );
		pVictim->TakeDamage( info );

		gamestats->Event_WeaponHit( ToBasePlayer( pPlayer ), true, GetClassname(), info );

		// Tracker 62293:  There's a bug where the inflictor/attacker are reversed when calling TakeDamage above so the player never gets
		//  credit for the strider buster kills.  The code has a bunch of assumptions lower level, so it's safer to just fix it here by 
		//  crediting a kill to the player directly.
		gamestats->Event_PlayerKilledOther( pPlayer, pVictim, info );
	}

	m_OnDetonate.FireOutput( this, this );

	// Explode
	if ( !m_bDud )
	{
		CreateDestroyedEffect();
		EmitSound( "Weapon_StriderBuster.Detonate" );
	}
	else
	{
		DispatchParticleEffect( "striderbuster_explode_dummy_core", GetAbsOrigin(), GetAbsAngles() );
		EmitSound( "Weapon_StriderBuster.Dud_Detonate" );
	}

	// Go to bits!
	Shatter( pVictim );
}
开发者ID:FooGames,项目名称:SecobMod,代码行数:38,代码来源:weapon_striderbuster.cpp

示例13: ConstraintThink

//-----------------------------------------------------------------------------
// Purpose: Check to see if any of our constrained players have broken the constraint
//-----------------------------------------------------------------------------
void CPointPlayerMoveConstraint::ConstraintThink( void )
{
	int iCount = m_hConstrainedPlayers.Count();

	// Count backwards, because we might drop them if they've broken the constraint
	for ( int i = (iCount-1); i >= 0; i-- )
	{
		CBasePlayer *pPlayer = ToBasePlayer( m_hConstrainedPlayers[i] );
		if ( pPlayer )
		{
			float flDistanceSqr = (pPlayer->GetAbsOrigin() - GetAbsOrigin()).LengthSqr();
			if ( flDistanceSqr > m_flRadiusSquared )
			{
				// Break the constraint to this player
				pPlayer->DeactivateMovementConstraint();
				m_hConstrainedPlayers.Remove(i);

				// Fire the broken output
				m_OnConstraintBroken.FireOutput( this, pPlayer );
			}
		}
	}

	// Only keep thinking if we any left
	if ( m_hConstrainedPlayers.Count() )
	{
		SetNextThink( gpGlobals->curtime + 0.1f );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:32,代码来源:point_playermoveconstraint.cpp

示例14: EnterVehicle

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropCannon::EnterVehicle( CBaseCombatCharacter *pPassenger )
{
	if ( pPassenger == NULL )
		return;

	CBasePlayer *pPlayer = ToBasePlayer( pPassenger );
	if ( pPlayer != NULL )
	{
		// Remove any player who may be in the vehicle at the moment
		if ( m_hPlayer )
		{
			ExitVehicle( VEHICLE_ROLE_DRIVER );
		}

		m_hPlayer = pPlayer;
		m_playerOn.FireOutput( pPlayer, this, 0 );

		//m_ServerVehicle.SoundStart();
	}
	else
	{
		// NPCs not supported yet - jdw
		Assert( 0 );
	}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:28,代码来源:vehicle_cannon.cpp

示例15: StartTunneling

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *player - 
//-----------------------------------------------------------------------------
void CObjectTunnelTrigger::StartTunneling( CBaseTFPlayer *player )
{
	if ( !player )
		return;

	// Ignore if it's already in the list
	int c = m_Tunneling.Count();
	for ( int i = 0 ; i < c; i++ )
	{
		TunnelPlayer *tp = &m_Tunneling[ i ];
		if ( tp->player == player )
		{
			return;
		}
	}

	TunnelPlayer tunnel;
	tunnel.player = player;
	tunnel.tunnelstarted = gpGlobals->curtime;
	tunnel.duration =  GetTeleportDuration();
	tunnel.teleporttime = tunnel.tunnelstarted + tunnel.duration;
	tunnel.exitstarted = false;
	tunnel.startpos = player->GetAbsOrigin();
	tunnel.iremaining = (int)tunnel.duration;
	tunnel.ilastremaining = tunnel.iremaining;
	tunnel.needremainigcounter = ( tunnel.iremaining > TUNNEL_DURATION_MESSAGE_NEEDED ) ? true : false;

	// Fade user screen to black
	color32 black = {0,0,0,255};

	float duration = tunnel.duration;
	float fadeouttime = TUNNEL_FADE_TIME;
	float holdtime = 0.0f;
	if ( duration < 2 * TUNNEL_FADE_TIME )
	{
		fadeouttime = duration * 0.5f;
	}
	else
	{
		fadeouttime = TUNNEL_FADE_TIME;
		holdtime = duration - 2 * fadeouttime;
	}

	tunnel.fadetime = fadeouttime;
	tunnel.fadeintime = tunnel.tunnelstarted + fadeouttime + holdtime;

	UTIL_ScreenFade( player, black, fadeouttime, holdtime, FFADE_OUT | FFADE_STAYOUT | FFADE_PURGE );

	m_Tunneling.AddToTail( tunnel );

	player->SetMoveType( MOVETYPE_NONE );
	player->EnableControl( false );
	player->AddEffects( EF_NODRAW );
	player->AddSolidFlags( FSOLID_NOT_SOLID );

	CPASAttenuationFilter filter( player, "ObjectTunnelTrigger.TeleportSound" );
	EmitSound( filter, player->entindex(), "ObjectTunnelTrigger.TeleportSound" );

	OnTunnelTriggerStart.FireOutput( player, this );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:64,代码来源:tf_obj_tunnel.cpp


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