public void PlayEMPEffect(EMPEffectReadyEvent e, EMPEffectNode effect, [JoinByTank] TankNode tank, [JoinAll] SingleNode <MapInstanceComponent> map) { EMPWaveGraphicsBehaviour behaviour = Object.Instantiate <EMPWaveGraphicsBehaviour>(tank.empWaveGraphicsEffect.EMPWaveAsset, tank.tankVisualRoot.transform.position, tank.tankVisualRoot.transform.rotation, map.component.SceneRoot.transform); float num2 = effect.empEffect.Radius * 2f; ParticleSystem waveParticleSystem = behaviour.WaveParticleSystem; ParticleSystem.SizeOverLifetimeModule sizeOverLifetime = waveParticleSystem.sizeOverLifetime; ParticleSystem.MinMaxCurve size = sizeOverLifetime.size; AnimationCurve curve = size.curve; Keyframe key = curve.keys[0]; key.value = (num2 * 0.152f) / 50f; curve.MoveKey(0, key); size.curveMultiplier = num2; sizeOverLifetime.size = size; AudioSource waveSound = behaviour.WaveSound; waveSound.transform.parent = null; waveSound.Play(); waveParticleSystem.Play(); Object.Destroy(behaviour.gameObject, waveParticleSystem.startLifetime + 0.5f); Object.Destroy(waveSound.gameObject, waveSound.clip.length + 0.5f); }
public void PlayEMPEffect(EMPEffectReadyEvent evt, [Combine] TankNode tank) { base.NewEvent <PlayEMPHitTargetTankEvent>().Attach(tank).ScheduleDelayed(tank.empWaveGraphicsEffect.EMPWaveAsset.WaveParticleSystem.startLifetime * 0.8f); }