Accessing the Particle Event Property under its Particle Type

Once you have a pointer to the particle type property (see Accessing the Particle Type Property under the Emitter Property) you can navigate through the Events container to its children below:

- The Events container nested under the particle type is not directly accessible through the particle type tree, so you have to use the Dictionary.GetObject method to access it before using SIObject.NestedObjects on its children (which are the events nested under the particle type node):

var pevt_container = Dictionary.GetObject( ptype.FullName + ".Events" );
rtn = pevt_container.NestedObjects;
e = null; e = new Enumerator( rtn );

// You can check specific parameters on each child to find the
// one that matches a particular event action or trigger, etc.
// For example, to find a basic obstacle event, you could look
// for a trigger with the 'Collision' value (11) and an action
// with the 'Bounce' value (3):
var pevent;
for ( ; !e.atEnd(); e.moveNext() ) {
   // As soon as the right PEvent is found, grab it and quit the loop
   if ( e.item().Parameters( "EventTrigger" ).Value == 11
          && e.item().Parameters( "EventAction" ).Value == 3 ) {
       pevent = e.item();
       break;
   }
}

 

Once you have one of these property objects (emitter property, particle type, particle event), you can use their ParameterCollection to get and set values on the individual parameters in the usual way.