public static void SetEmitterSignal(int emitterId, int signal) { var emitter = Emitters.FirstOrDefault(e => e.Id == emitterId); if (emitter == null) { return; } emitter.Signal = signal; NotifyReceivers(emitter.EmitChannel, signal); }
internal static ParticleEmitter TryGet(IntPtr handle) { #if !(RELEASE && RELEASE_DISABLE_CHECKS) if (handle == IntPtr.Zero) { throw new NullPointerException(); } #endif var particleEmitter = Emitters.FirstOrDefault(x => x.Handle == handle); if (particleEmitter == null) { particleEmitter = new ParticleEmitter(handle); Emitters.Add(particleEmitter); } return(particleEmitter); }
public static void ChangeEmitterChannel(int emitterId, int channel) { var emitter = Emitters.FirstOrDefault(e => e.Id == emitterId); if (emitter == null) { return; } var othersOnChannel = Emitters.Where(e => e.Id != emitterId && e.EmitChannel == emitter.EmitChannel).ToList(); var leaveSignal = othersOnChannel.Any() ? othersOnChannel.First().Signal : 0; NotifyReceivers(emitter.EmitChannel, leaveSignal); emitter.EmitChannel = channel; NotifyReceivers(emitter.EmitChannel, emitter.Signal); }
public static void UnregisterEmitter(int emitterId) { var emitter = Emitters.FirstOrDefault(e => e.Id == emitterId); Emitters.Remove(emitter); }