// Run ParticleEvent each time a particle sends an Event void ParticleEvent(PlaygroundEventParticle particle) { if (Vector3.Distance(particle.position, thisPosition) <= killRange) { particles.Kill(particle.particleId); } }
// Run ParticleEvent each time a particle sends an Event void ParticleEvent(PlaygroundEventParticle particle) { // If the particle's collider is this then change the localAxisRotation based on particle's size and velocity if (particle.collisionCollider == thisCollider) { localAxisRotation += particle.size * particle.velocity.magnitude * collisionAmplifier; } }
private void ShotEvent(PlaygroundEventParticle EvParticle) { if (EvParticle != null) { Debug.Log("Event triggered " + EvParticle); } enemyPawnToAttack.TakeDamageFromProjectile(DmgValue); enemyPawnToAttack.RecevingDamageDone(); }
/// <summary> /// Event listener for particle death. /// </summary> /// <param name="particle">Particle.</param> void OnParticleDidDie(PlaygroundEventParticle particle) { int followerId = GetFollowerWithId(particle.particleId); if (followerId < 0) { return; } followers[followerId].enabled = false; }
/// <summary> /// This function will run whenever a particle enters the extents of the Manipulator. /// </summary> /// <param name="particle">Particle.</param> void OnManipulatorEnter(PlaygroundEventParticle particle) { // Do something here // Debug.Log("Particle "+particle.particleId+" from particle system "+particle.particleSystemId+" at position "+particle.position+" is within the Manipulator."); // Then remove the particle from its current location particles.Kill(particle.particleId); // Increase pickups by one pickups++; }
/// <summary> /// This function will be called whenever a particle is colliding. /// </summary> /// <param name="particle">The collided particle.</param> void OnParticleCollisionEvent(PlaygroundEventParticle particle) { if (createPointsOnCollision) { int trailIndex = GetNewestTrailWithParticleId(particle.particleId); if (trailIndex < 0) { return; } ParticlePlaygroundTrail trailAtIndex = _trails[trailIndex]; trailAtIndex.AddPoint(playgroundSystem.particleCache[particle.particleId].position, EvaluateWidth(0), time, _calculationStartTime); } }
void Teleport(PlaygroundEventParticle eventParticle) { // Store the necessary values of this particle int particleId = eventParticle.particleId; Vector3 particlePosition = eventParticle.position; // Get the thread-safe position of the manipulator Vector3 manipulatorPosition = _manipulator.transform.position; // Set the position of the particle towards the target with an offset Vector3 offsetedTargetPosition = _targetPosition + (particlePosition - manipulatorPosition); particles.ParticlePosition(particleId, offsetedTargetPosition); }
/// <summary> /// This function will be called whenever a particle has died. /// </summary> /// <param name="particle">The particle which died.</param> void OnParticleDeathEvent(PlaygroundEventParticle particle) { int trailIndex = GetOldestTrailWithParticleId(particle.particleId); if (trailIndex > -1) { if (createLastPointOnParticleDeath) { _trails[trailIndex].SetLastPoint(particle.position, particle.velocity, EvaluateWidth(0), time, _calculationStartTime); } else { _trails[trailIndex].SetParticlePosition(particle.position); _trails[trailIndex].Die(); } } }
void OnManipulatorEnter(PlaygroundEventParticle particle) { /* A manipulator using events will send information to any Event Listeners (such as this function). * OnManipulatorEnter() has hooked up in Start() to the Event Delegate of the manipulator attached to bubbleParticles. * Whenever a particle enters the confined space of the manipulator OnManipulatorEnter() will be called. * You can use this to know which particle it is, where it entered and extract further information such as velocity, * size, color and if it has been altered by any properties. The particle id is the same number as within its position * in the playgroundCache. Uncomment the section below for an example in the console. */ /* * Debug.Log ("Position: "+ particle.position +"\n"+ * "Velocity: "+ particle.velocity +"\n"+ * "Color: "+ particle.color +"\n"+ * "Particle System Id: "+ particle.particleSystemId +"\n"+ * "Particle Id: "+ particle.particleId +"\n" * ); */ }
void OnEventParticleDeath(PlaygroundEventParticle particle) { Debug.Log("A particle died at " + particle.position + " with the velocity of " + particle.velocity + ". It was born in " + particle.targetPosition); }
/// <summary> /// Emits particles whenever the event is triggered. You could use more info from the passed in event particle if you'd like for more advanced emission behaviors. /// Note that this will by default be called on a second thread. /// </summary> /// <param name="particle">Event Particle.</param> void EmitOnEvent(PlaygroundEventParticle particle) { particlesEmit.ThreadSafeEmit(emitCount, particle.collisionParticlePosition, randomVelocityMin, randomVelocityMax, color); }
/**************************************************************************** * Event Listeners ****************************************************************************/ /// <summary> /// This function will be called whenever a particle is birthed. /// </summary> /// <param name="particle">The birthed particle.</param> void OnParticleBirthEvent(PlaygroundEventParticle particle) { _birthQueue.Enqueue(new TrailParticleInfo(particle.particleId, particle.position, particle.velocity)); }
/// <summary> /// Called upon the event, this function will be called from a different thread if multithreading is enabled. /// </summary> void OnParticleEvent(PlaygroundEventParticle particle) { queuedSystems.Add(particle.position); }
void OnManipulatorExit(PlaygroundEventParticle particle) { // A particle left the manipulator. Uncomment the line below for an example in the console. //Debug.Log ("Particle "+particle.particleId+" from system "+particle.particleSystemId+" left the manipulator."); }
void OnManipulatorDeath(PlaygroundEventParticle particle) { // A particle has died inside the manipulator. Uncomment the line below for an example in the console. //Debug.Log ("Particle "+particle.particleId+" from system "+particle.particleSystemId+" has died inside the manipulator."); }
void OnManipulatorCollision(PlaygroundEventParticle particle) { // A particle has collided inside the manipulator. You need to activate collision on bubbleParticles for this function to have effect. Uncomment the line below for an example in the console. //Debug.Log ("Particle "+particle.particleId+" from system "+particle.particleSystemId+" has collided with "+particle.collisionTransform.name+" at position "+particle.collisionParticlePosition+" inside the manipulator."); }
void OnEventParticleBirth(PlaygroundEventParticle particle) { Debug.Log("A particle came to life at " + particle.position + " with a size of " + particle.size); }
/// <summary> /// Event listener for particle birth. /// </summary> /// <param name="particle">Particle.</param> void OnParticleDidBirth(PlaygroundEventParticle particle) { waitingFollowers.Add(new PlaygroundFollower(null, null, null, followerLifetime <= 0? particle.totalLifetime + trailTime : followerLifetime, particle.particleId)); }
void OnEventParticleCollision(PlaygroundEventParticle particle) { Debug.Log("A particle collided at " + particle.position + " with " + particle.collisionTransform.name + ". The id of the particle was " + particle.particleId + " from particle system " + particle.particleSystemId); }
// DoSomething will run when a particle triggers the Event void DoSomething(PlaygroundEventParticle particle) { gizmoPosition = particle.position; }
void OnEventParticleTime(PlaygroundEventParticle particle) { Debug.Log("A particle called in at " + particle.position + " with the lifetime of " + particle.life); }