本文整理汇总了C++中PostEventSec函数的典型用法代码示例。如果您正苦于以下问题:C++ PostEventSec函数的具体用法?C++ PostEventSec怎么用?C++ PostEventSec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PostEventSec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Show
/*
================
idMoveable::Event_Activate
================
*/
void idMoveable::Event_Activate( idEntity *activator ) {
float delay;
idVec3 init_velocity, init_avelocity;
Show();
if ( !spawnArgs.GetInt( "notPushable" ) ) {
physicsObj.EnableImpact();
}
physicsObj.Activate();
spawnArgs.GetVector( "init_velocity", "0 0 0", init_velocity );
spawnArgs.GetVector( "init_avelocity", "0 0 0", init_avelocity );
delay = spawnArgs.GetFloat( "init_velocityDelay", "0" );
if ( delay == 0.0f ) {
physicsObj.SetLinearVelocity( init_velocity );
} else {
PostEventSec( &EV_SetLinearVelocity, delay, init_velocity );
}
delay = spawnArgs.GetFloat( "init_avelocityDelay", "0" );
if ( delay == 0.0f ) {
physicsObj.SetAngularVelocity( init_avelocity );
} else {
PostEventSec( &EV_SetAngularVelocity, delay, init_avelocity );
}
InitInitialSpline( gameLocal.time );
}
开发者ID:alepulver,项目名称:dhewm3,代码行数:36,代码来源:Moveable.cpp
示例2: item
/*
================
idEntityFx::Event_ClearFx
Clears any visual fx started when item(mob) was spawned
================
*/
void idEntityFx::Event_ClearFx( void )
{
if( g_skipFX.GetBool() )
{
return;
}
Stop();
CleanUp();
BecomeInactive( TH_THINK );
if( spawnArgs.GetBool( "test" ) )
{
PostEventMS( &EV_Activate, 0, this );
}
else
{
if( spawnArgs.GetFloat( "restart" ) || !spawnArgs.GetBool( "triggered" ) )
{
float rest = spawnArgs.GetFloat( "restart", "0" );
if( rest == 0.0f )
{
PostEventSec( &EV_Remove, 0.1f );
}
else
{
rest *= gameLocal.random.RandomFloat();
PostEventSec( &EV_Activate, rest, this );
}
}
}
}
开发者ID:revelator,项目名称:MHDoom,代码行数:40,代码来源:Fx.cpp
示例3: ServerSendEvent
/*
================
idItem::Pickup
================
*/
bool idItem::Pickup(idPlayer *player)
{
if (!GiveToPlayer(player)) {
return false;
}
if (gameLocal.isServer) {
ServerSendEvent(EVENT_PICKUP, NULL, false, -1);
}
// play pickup sound
StartSound("snd_acquire", SND_CHANNEL_ITEM, 0, false, NULL);
// trigger our targets
ActivateTargets(player);
// clear our contents so the object isn't picked up twice
GetPhysics()->SetContents(0);
// hide the model
Hide();
// add the highlight shell
if (itemShellHandle != -1) {
gameRenderWorld->FreeEntityDef(itemShellHandle);
itemShellHandle = -1;
}
float respawn = spawnArgs.GetFloat("respawn");
bool dropped = spawnArgs.GetBool("dropped");
bool no_respawn = spawnArgs.GetBool("no_respawn");
if (gameLocal.isMultiplayer && respawn == 0.0f) {
respawn = 20.0f;
}
if (respawn && !dropped && !no_respawn) {
const char *sfx = spawnArgs.GetString("fxRespawn");
if (sfx && *sfx) {
PostEventSec(&EV_RespawnFx, respawn - 0.5f);
}
PostEventSec(&EV_RespawnItem, respawn);
} else if (!spawnArgs.GetBool("inv_objective") && !no_respawn) {
// give some time for the pickup sound to play
// FIXME: Play on the owner
if (!spawnArgs.GetBool("inv_carry")) {
PostEventMS(&EV_Remove, 5000);
}
}
BecomeInactive(TH_THINK);
return true;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:61,代码来源:Item.cpp
示例4: DrawFov
/*
================
idSecurityCamera::Think
================
*/
void idSecurityCamera::Think( void ) {
float pct;
float travel;
if( thinkFlags & TH_THINK ) {
if( g_showEntityInfo.GetBool() ) {
DrawFov();
}
if( health <= 0 ) {
BecomeInactive( TH_THINK );
return;
}
}
// run physics
RunPhysics();
if( thinkFlags & TH_THINK ) {
if( CanSeePlayer() ) {
if( alertMode == SCANNING ) {
float sightTime;
SetAlertMode( ALERT );
stopSweeping = gameLocal.time;
if( sweeping ) {
CancelEvents( &EV_SecurityCam_Pause );
} else {
CancelEvents( &EV_SecurityCam_ReverseSweep );
}
sweeping = false;
StopSound( SND_CHANNEL_ANY, false );
StartSound( "snd_sight", SND_CHANNEL_BODY, 0, false, NULL );
sightTime = spawnArgs.GetFloat( "sightTime", "5" );
PostEventSec( &EV_SecurityCam_Alert, sightTime );
}
} else {
if( alertMode == ALERT ) {
float sightResume;
SetAlertMode( LOSINGINTEREST );
CancelEvents( &EV_SecurityCam_Alert );
sightResume = spawnArgs.GetFloat( "sightResume", "1.5" );
PostEventSec( &EV_SecurityCam_ContinueSweep, sightResume );
}
if( sweeping ) {
idAngles a = GetPhysics()->GetAxis().ToAngles();
pct = ( gameLocal.time - sweepStart ) / ( sweepEnd - sweepStart );
travel = pct * sweepAngle;
if( negativeSweep ) {
a.yaw = angle + travel;
} else {
a.yaw = angle - travel;
}
SetAngles( a );
}
}
}
Present();
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:59,代码来源:SecurityCamera.cpp
示例5: SEC2MS
/*
================
hhProjectileCrawlerGrenade::Launch
================
*/
void hhProjectileCrawlerGrenade::Launch( const idVec3 &start, const idMat3 &axis, const idVec3 &pushVelocity, const float timeSinceFire, const float launchPower, const float dmgPower ) {
hhProjectile::Launch( start, axis, pushVelocity, timeSinceFire, launchPower, dmgPower );
if( modelProxy.IsValid() ) {
modelProxy->CycleAnim( "flight", ANIMCHANNEL_ALL );
}
float delayBeforeDying = spawnArgs.GetFloat( "delayBeforeDying" );
float fuse = spawnArgs.GetFloat( "fuse" );
inflateDuration = SEC2MS( hhMath::ClampFloat(0.0f, fuse, fuse - delayBeforeDying) );
PostEventSec( &EV_DyingState, delayBeforeDying );
PostEventSec( &EV_DeadState, fuse );
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:20,代码来源:prey_projectilecrawlergrenade.cpp
示例6: StartSound
/*
================
idItem::Pickup
================
*/
bool idItem::Pickup( idPlayer *player ) {
if ( !GiveToPlayer( player ) ) {
return false;
}
// play pickup sound
StartSound( "snd_acquire", SND_CHANNEL_ITEM, 0, false, NULL );
// sikk - play the sounds through the player
//player->StartSoundShader( declManager->FindSound( spawnArgs.GetString( "snd_acquire" ) ), SND_CHANNEL_ITEM, SSF_PRIVATE_SOUND, false, NULL );
// trigger our targets
ActivateTargets( player );
// clear our contents so the object isn't picked up twice
GetPhysics()->SetContents( 0 );
// hide the model
Hide();
FreeLightDef(); // sikk - Crumb Light
// add the highlight shell
if ( itemShellHandle != -1 ) {
gameRenderWorld->FreeEntityDef( itemShellHandle );
itemShellHandle = -1;
}
float respawn = spawnArgs.GetFloat( "respawn" );
bool dropped = spawnArgs.GetBool( "dropped" );
bool no_respawn = spawnArgs.GetBool( "no_respawn" );
if ( respawn && !dropped && !no_respawn ) {
const char *sfx = spawnArgs.GetString( "fxRespawn" );
if ( sfx && *sfx ) {
PostEventSec( &EV_RespawnFx, respawn - 0.5f );
}
PostEventSec( &EV_RespawnItem, respawn );
} else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) {
// give some time for the pickup sound to play
// FIXME: Play on the owner
if ( !spawnArgs.GetBool( "inv_carry" ) ) {
PostEventMS( &EV_Remove, 5000 );
}
}
BecomeInactive( TH_THINK );
return true;
}
开发者ID:RobertBeckebans,项目名称:Sikkpin-Breadcrumps-src,代码行数:53,代码来源:Item.cpp
示例7: Hide
void hhGibbable::Explode(idEntity *activator) {
hhFxInfo fxInfo;
Hide();
fl.takedamage = false;
GetPhysics()->SetContents( 0 );
ActivateTargets( activator );
SetSkinByName(NULL);
if ( spawnArgs.GetFloat( "respawn", "0" ) ) {
PostEventSec( &EV_Respawn, spawnArgs.GetFloat( "respawn", "0" ) );
} else {
PostEventMS( &EV_Remove, 200 ); // Remove after a small delay to allow sound commands to execute
}
StartSound( "snd_gib", SND_CHANNEL_ANY );
// Find thinnest axis in the bounds and use for fx normal
idVec3 thinnest = vec3_origin;
int axisIndex = DetermineThinnestAxis();
thinnest[axisIndex] = 1.0f;
thinnest *= GetAxis();
fxInfo.RemoveWhenDone( true );
fxInfo.SetNormal(thinnest);
// Spawn FX system for gib
BroadcastFxInfo( spawnArgs.GetString("fx_gib"), GetOrigin(), GetAxis(), &fxInfo );
// Spawn gibs
if (spawnArgs.FindKey("def_debrisspawner")) {
hhUtils::SpawnDebrisMass(spawnArgs.GetString("def_debrisspawner"), this );
}
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:31,代码来源:game_gibbable.cpp
示例8: sequence
/*
================
idTrigger_EntityName::Event_Trigger
the trigger was just activated
activated should be the entity that originated the activation sequence (ie. the original target)
activator should be set to the activator so it can be held through a delay
so wait for the delay time before firing
================
*/
void idTrigger_EntityName::Event_Trigger( idEntity *activator ) {
if ( nextTriggerTime > gameLocal.time ) {
// can't retrigger until the wait is over
return;
}
if ( !activator || ( activator->name != entityName ) ) {
return;
}
if ( triggerFirst ) {
triggerFirst = false;
return;
}
// don't allow it to trigger twice in a single frame
nextTriggerTime = gameLocal.time + 1;
if ( delay > 0 ) {
// don't allow it to trigger again until our delay has passed
nextTriggerTime += SEC2MS( delay + random_delay * gameLocal.random.CRandomFloat() );
PostEventSec( &EV_TriggerAction, delay, activator );
} else {
TriggerAction( activator );
}
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:36,代码来源:Trigger.cpp
示例9: clipBounds
/*
=================
hhProjectileCrawlerGrenade::Event_ApplyExpandWound
=================
*/
void hhProjectileCrawlerGrenade::Event_ApplyExpandWound() {
trace_t trace;
if( !modelProxy.IsValid() || !modelProxy->GetCombatModel() ) {
return;
}
idBounds clipBounds( modelProxy->GetRenderEntity()->bounds );
idVec3 traceEnd = GetOrigin();
idVec3 traceStart = traceEnd + hhUtils::RandomPointInShell( clipBounds.Expand(1.0f).GetRadius(), clipBounds.Expand(2.0f).GetRadius() );
idVec3 jointOrigin, localOrigin, localNormal;
idMat3 jointAxis, axisTranspose;
jointHandle_t jointHandle = INVALID_JOINT;
CancelEvents( &EV_ApplyExpandWound );
PostEventSec( &EV_ApplyExpandWound, spawnArgs.GetFloat("expandWoundDelay") );
if( !gameLocal.clip.TracePoint(trace, traceStart, traceEnd, modelProxy->GetCombatModel()->GetContents(), NULL) ) {
return;
}
if( trace.c.entityNum != entityNumber ) {//Make sure we hit ourselves
return;
}
modelProxy->AddDamageEffect( trace, vec3_zero, spawnArgs.GetString("def_expandDamage"), (!fl.networkSync || netSyncPhysics) );
}
开发者ID:mrwonko,项目名称:preymotionmod,代码行数:32,代码来源:prey_projectilecrawlergrenade.cpp
示例10: SEC2MS
/*
================
idTrigger_EntityName::Event_Touch
================
*/
void idTrigger_EntityName::Event_Touch( idEntity *other, trace_t *trace )
{
if( triggerFirst )
{
return;
}
if( nextTriggerTime > gameLocal.time )
{
// can't retrigger until the wait is over
return;
}
if( !other || ( other->name != entityName ) )
{
return;
}
nextTriggerTime = gameLocal.time + 1;
if( delay > 0 )
{
// don't allow it to trigger again until our delay has passed
nextTriggerTime += SEC2MS( delay + random_delay * gameLocal.random.CRandomFloat() );
PostEventSec( &EV_TriggerAction, delay, other );
}
else
{
TriggerAction( other );
}
}
开发者ID:revelator,项目名称:MHDoom,代码行数:35,代码来源:Trigger.cpp
示例11: Setup
/*
================
idEntityFx::Event_Trigger
================
*/
void idEntityFx::Event_Trigger( idEntity *activator ) {
if ( g_skipFX.GetBool() ) {
return;
}
float fxActionDelay;
const char *fx;
if ( gameLocal.time < nextTriggerTime ) {
return;
}
if ( spawnArgs.GetString( "fx", "", &fx) ) {
Setup( fx );
Start( gameLocal.time );
PostEventMS( &EV_Fx_KillFx, Duration() );
BecomeActive( TH_THINK );
}
fxActionDelay = spawnArgs.GetFloat( "fxActionDelay" );
if ( fxActionDelay != 0.0f ) {
nextTriggerTime = gameLocal.time + SEC2MS( fxActionDelay );
} else {
// prevent multiple triggers on same frame
nextTriggerTime = gameLocal.time + 1;
}
PostEventSec( &EV_Fx_Action, fxActionDelay, activator );
}
开发者ID:Salamek,项目名称:Shadow-of-Dust,代码行数:34,代码来源:Fx.cpp
示例12: CancelEvents
/*
================
idSound::Event_Trigger
this will toggle the idle idSound on and off
================
*/
void idSound::Event_Trigger( idEntity *activator ) {
if ( wait > 0.0f ) {
if ( timerOn ) {
timerOn = false;
CancelEvents( &EV_Speaker_Timer );
} else {
timerOn = true;
DoSound( true );
PostEventSec( &EV_Speaker_Timer, wait + gameLocal.random.CRandomFloat() * random );
}
} else {
if ( gameLocal.isMultiplayer ) {
if ( refSound.referenceSound && ( gameLocal.time < playingUntilTime ) ) {
DoSound( false );
} else {
DoSound( true );
}
} else {
if ( refSound.referenceSound && refSound.referenceSound->CurrentlyPlaying() ) {
DoSound( false );
} else {
DoSound( true );
}
}
}
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:33,代码来源:Sound.cpp
示例13: at
/*
================
idSound::Spawn
================
*/
void idSound::Spawn( void )
{
spawnArgs.GetVector( "move", "0 0 0", shakeTranslate );
spawnArgs.GetAngles( "rotate", "0 0 0", shakeRotate );
spawnArgs.GetFloat( "random", "0", random );
spawnArgs.GetFloat( "wait", "0", wait );
if( ( wait > 0.0f ) && ( random >= wait ) )
{
random = wait - 0.001;
gameLocal.DWarning( "speaker '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString( 0 ) );
}
soundVol = 0.0f;
lastSoundVol = 0.0f;
if( ( shakeRotate != ang_zero ) || ( shakeTranslate != vec3_zero ) )
{
BecomeActive( TH_THINK );
}
if( !refSound.waitfortrigger && ( wait > 0.0f ) )
{
timerOn = true;
PostEventSec( &EV_Speaker_Timer, wait + gameLocal.random.CRandomFloat() * random );
}
else
{
timerOn = false;
}
}
开发者ID:revelator,项目名称:MHDoom,代码行数:36,代码来源:Sound.cpp
示例14: sequence
/*
================
idTrigger_Multi::Event_Trigger
the trigger was just activated
activated should be the entity that originated the activation sequence (ie. the original target)
activator should be set to the activator so it can be held through a delay
so wait for the delay time before firing
================
*/
void idTrigger_Multi::Event_Trigger( idEntity *activator ) {
// RAVEN BEGIN
// bdube: moved trigger first
if ( triggerFirst ) {
triggerFirst = false;
return;
}
if ( nextTriggerTime > gameLocal.time ) {
// can't retrigger until the wait is over
return;
}
// see if this trigger requires an item
if ( !gameLocal.RequirementMet( activator, requires, removeItem ) ) {
return;
}
if ( !CheckFacing( activator ) ) {
return;
}
// RAVEN END
// don't allow it to trigger twice in a single frame
nextTriggerTime = gameLocal.time + 1;
if ( delay > 0 ) {
// don't allow it to trigger again until our delay has passed
nextTriggerTime += SEC2MS( delay + random_delay * gameLocal.random.CRandomFloat() );
PostEventSec( &EV_TriggerAction, delay, activator );
} else {
TriggerAction( activator );
}
}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:44,代码来源:Trigger.cpp
示例15: PostEventSec
/*
================
idTrigger_Timer::Enable
================
*/
void idTrigger_Timer::Enable( void ) {
// if off, turn it on
if ( !on ) {
on = true;
PostEventSec( &EV_Timer, delay );
}
}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:12,代码来源:Trigger.cpp
示例16: at
/*
================
idSound::Spawn
================
*/
void idSound::Spawn( void ) {
spawnArgs.GetVector( "move", "0 0 0", shakeTranslate );
spawnArgs.GetAngles( "rotate", "0 0 0", shakeRotate );
spawnArgs.GetFloat( "random", "0", random );
spawnArgs.GetFloat( "wait", "0", wait );
if ( ( wait > 0.0f ) && ( random >= wait ) ) {
random = wait - 0.001;
gameLocal.Warning( "speaker '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) );
}
soundVol = 0.0f;
lastSoundVol = 0.0f;
if ( ( shakeRotate != ang_zero ) || ( shakeTranslate != vec3_zero ) ) {
BecomeActive( TH_THINK );
}
if ( !refSound.waitfortrigger && ( wait > 0.0f ) ) {
timerOn = true;
PostEventSec( &EV_Speaker_Timer, wait + gameLocal.random.CRandomFloat() * random );
} else {
timerOn = false;
}
// add this speaker to the list of ambient music speakers affected by tdm_music_volume
if ( spawnArgs.GetBool( "s_music" ) ) {
gameLocal.musicSpeakers.Append( entityNumber );
}
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:34,代码来源:Sound.cpp
示例17: PostEventSec
/*
================
idSound::Event_On
================
*/
void idSound::Event_On( void ) {
if ( wait > 0.0f ) {
timerOn = true;
PostEventSec( &EV_Speaker_Timer, wait + gameLocal.random.CRandomFloat() * random );
}
DoSound( true );
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:12,代码来源:Sound.cpp
示例18: SEC2MS
/*
================
idTrigger_EntityName::Event_Touch
================
*/
void idTrigger_EntityName::Event_Touch( idEntity *other, trace_t *trace ) {
if( triggerFirst ) {
return;
}
if ( nextTriggerTime > gameLocal.time ) {
// can't retrigger until the wait is over
return;
}
// RAVEN BEGIN
// abahr: so we can exclude an entity by name
if( !other ) {
return;
}
if( spawnArgs.GetBool("excludeEntityName") && other->name == entityName ) {
return;
}
if( !spawnArgs.GetBool("excludeEntityName") && other->name != entityName ) {
return;
}
// RAVEN END
nextTriggerTime = gameLocal.time + 1;
if ( delay > 0 ) {
// don't allow it to trigger again until our delay has passed
nextTriggerTime += SEC2MS( delay + random_delay * gameLocal.random.CRandomFloat() );
PostEventSec( &EV_TriggerAction, delay, other );
} else {
TriggerAction( other );
}
}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:39,代码来源:Trigger.cpp
示例19: GetPhysics
/*
================
idExplodingBarrel::Event_Respawn
================
*/
void idExplodingBarrel::Event_Respawn() {
int i;
int minRespawnDist = spawnArgs.GetInt( "respawn_range", "256" );
if ( minRespawnDist ) {
float minDist = -1;
for ( i = 0; i < gameLocal.numClients; i++ ) {
if ( !gameLocal.entities[ i ] || !gameLocal.entities[ i ]->IsType( idPlayer::Type ) ) {
continue;
}
idVec3 v = gameLocal.entities[ i ]->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
float dist = v.Length();
if ( minDist < 0 || dist < minDist ) {
minDist = dist;
}
}
if ( minDist < minRespawnDist ) {
PostEventSec( &EV_Respawn, spawnArgs.GetInt( "respawn_again", "10" ) );
return;
}
}
const char *temp = spawnArgs.GetString( "model" );
if ( temp && *temp ) {
SetModel( temp );
}
health = spawnArgs.GetInt( "health", "5" );
fl.takedamage = true;
physicsObj.SetOrigin( spawnOrigin );
physicsObj.SetAxis( spawnAxis );
physicsObj.SetContents( CONTENTS_SOLID );
physicsObj.DropToFloor();
state = NORMAL;
Show();
UpdateVisuals();
}
开发者ID:alepulver,项目名称:dhewm3,代码行数:39,代码来源:Moveable.cpp
示例20: ActivateTargets
/*
================
idTrigger_Timer::Event_Timer
================
*/
void idTrigger_Timer::Event_Timer( void ) {
ActivateTargets( this );
// set time before next firing
if( wait >= 0.0f ) {
PostEventSec( &EV_Timer, wait + gameLocal.random.CRandomFloat() * random );
}
}
开发者ID:nbohr1more,项目名称:Revelation,代码行数:12,代码来源:Trigger.cpp
注:本文中的PostEventSec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论