public ParticleEmitter(string name, TextureRegion2D textureRegion, int capacity, TimeSpan lifeSpan, Profile profile) { _lifeSpanSeconds = (float)lifeSpan.TotalSeconds; Name = name; TextureRegion = textureRegion; Buffer = new ParticleBuffer(capacity); Offset = Vector2.Zero; Profile = profile ?? throw new ArgumentNullException(nameof(profile)); Modifiers = new List <ParticleModifier>(); ModifierExecutionStrategy = ParticleModifierExecutionStrategy.Serial; Parameters = new ParticleReleaseParameters(); }
public ParticleEmitter(int capacity, TimeSpan term, Profile profile) { if (profile == null) throw new ArgumentNullException(nameof(profile)); _term = (float)term.TotalSeconds; Buffer = new ParticleBuffer(capacity); Offset = new Vector2(); Profile = profile; Modifiers = new IModifier[0]; ModifierExecutionStrategy = ParticleModifierExecutionStrategy.Serial; Parameters = new ParticleReleaseParameters(); }
public unsafe Iterator(ParticleBuffer buffer, int offset) { _buffer = buffer; _current = _buffer.Head; if (offset != 0) { _current = _buffer.Head + offset; if (_current >= _buffer.BufferEnd) { _current -= _buffer.Size + 1; } } }
public ParticleEmitter(int capacity, TimeSpan term, Profile profile) { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } _term = (float)term.TotalSeconds; Buffer = new ParticleBuffer(capacity); Offset = new Vector2(); Profile = profile; Modifiers = new IModifier[0]; ModifierExecutionStrategy = ParticleModifierExecutionStrategy.Serial; Parameters = new ParticleReleaseParameters(); }
public ParticleEmitter(TextureRegion2D textureRegion, int capacity, TimeSpan term, Profile profile, bool autoTrigger = true) { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } _term = (float)term.TotalSeconds; _autoTrigger = autoTrigger; TextureRegion = textureRegion; Buffer = new ParticleBuffer(capacity); Offset = Vector2.Zero; Profile = profile; Modifiers = new IModifier[0]; ModifierExecutionStrategy = ParticleModifierExecutionStrategy.Serial; Parameters = new ParticleReleaseParameters(); }
public ParticleIterator(ParticleBuffer buffer) { _buffer = buffer; }
internal abstract void ExecuteModifiers(IEnumerable<IModifier> modifiers, float elapsedSeconds, ParticleBuffer.ParticleIterator iterator);
internal override void ExecuteModifiers(IEnumerable<IModifier> modifiers, float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { TPL.Parallel.ForEach(modifiers, modifier => modifier.Update(elapsedSeconds, iterator.Reset())); }
internal override void ExecuteModifiers(IEnumerable<IModifier> modifiers, float elapsedSeconds, ParticleBuffer.ParticleIterator iterator) { foreach (var modifier in modifiers) modifier.Update(elapsedSeconds, iterator.Reset()); }
public unsafe Iterator(ParticleBuffer buffer) : this(buffer, 0) { }