本文整理汇总了C++中Event::AddEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::AddEntity方法的具体用法?C++ Event::AddEntity怎么用?C++ Event::AddEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::AddEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Pickup
void ThrowObject::Pickup( Entity *ent, const str &bone )
{
Event *e;
setOrigin( pickup_offset );
e = new Event( EV_Attach );
e->AddEntity( ent );
e->AddString( bone );
ProcessEvent( e );
hurt_target = false;
edict->s.renderfx &= ~RF_FRAMELERP;
}
示例2: ItemTouch
void Item::ItemTouch( Event *ev )
{
Entity *other;
Event *e;
if ( owner )
{
// Don't respond to trigger events after item is picked up.
// we really don't need to see this.
//gi.DPrintf( "%s with targetname of %s was triggered unexpectedly.\n", getClassID(), TargetName() );
return;
}
other = ev->GetEntity( 1 );
e = new Event( EV_Item_Pickup );
e->AddEntity( other );
ProcessEvent( e );
}
示例3: getAmount
//.........这里部分代码省略.........
if ( gpm->hasProperty(getArchetype(), "noautopickup") )
return NULL;
}
if ( !Pickupable( other ) )
{
return NULL;
}
sent = ( Sentient * )other;
if ( add_to_inventory )
{
item = sent->giveItem( model, getAmount(), true );
if ( !item )
return NULL;
}
else
{
item = this;
}
//
// make sure to copy over the coolness factor :)
//
item->coolitem = coolitem;
item->cool_dialog = cool_dialog;
item->cool_anim = cool_anim;
item->coolitemforced = coolitemforced;
//
// let our sent know they received it
// we put this here so we can transfer information from the original item we picked up
//
if ( !isSubclassOf( Weapon ) || add_to_inventory )
sent->ReceivedItem( item );
realname = GetRandomAlias( "snd_pickup" );
if ( realname.length() > 1 )
sent->Sound( realname, CHAN_ITEM );
if ( !Removable() )
{
// leave the item for others to pickup
return item;
}
look_at_me = false;
CancelEventsOfType( EV_Item_DropToFloor );
CancelEventsOfType( EV_Item_Respawn );
CancelEventsOfType( EV_FadeOut );
setSolidType( SOLID_NOT );
if ( animate && animate->HasAnim( "pickup" ) )
animate->RandomAnimate( "pickup", EV_Item_PickupDone );
else
{
if ( !no_remove )
{
if ( _missingSkin )
{
ChangeSkin( _missingSkin, true );
}
else
{
hideModel();
}
if ( !Respawnable() )
PostEvent( EV_Remove, FRAMETIME );
}
}
if ( Respawnable() )
PostEvent( EV_Item_Respawn, RespawnTime() );
// fire off any pickup_thread's
if ( pickup_thread.length() )
{
ExecuteThread( pickup_thread );
}
if ( item && multiplayerManager.checkFlag( MP_FLAG_INSTANT_ITEMS ) )
{
Event *ev;
ev = new Event( EV_InventoryItem_Use );
ev->AddEntity( other );
item->ProcessEvent( ev );
}
return item;
}
示例4: Killed
void Object::Killed(Event *ev)
{
Entity * ent;
Entity * attacker;
Vector dir;
Event * event;
const char * name;
takedamage = DamageNo;
setSolidType( SOLID_NOT );
hideModel();
attacker = ev->GetEntity( 1 );
if (flags & FlagDieExplode)
{
CreateExplosion( origin, 50.0f, this, this, this );
}
if (flags & FlagDieGibs)
{
setSolidType( SOLID_NOT );
hideModel();
CreateGibs( this, -150.0f, edict->s.scale, 3 );
}
//
// kill the killtargets
//
name = KillTarget();
if ( name && strcmp( name, "" ) )
{
ent = NULL;
do
{
ent = G_FindTarget( ent, name );
if ( !ent )
{
break;
}
ent->PostEvent( EV_Remove, 0.0f );
}
while ( 1 );
}
//
// fire targets
//
name = Target();
if ( name && strcmp( name, "" ) )
{
ent = NULL;
do
{
ent = G_FindTarget( ent, name );
if ( !ent )
{
break;
}
event = new Event( EV_Activate );
event->AddEntity( attacker );
ent->ProcessEvent( event );
}
while ( 1 );
}
PostEvent( EV_Remove, 0.0f );
}