コード例 #1
0
        public void Simulate(float duration)
        {
            var steps = duration / Interval;

            for (var i = 0; i < steps; i++)
            {
                for (int j = 0; j < Amount; j++)
                {
                    // create the particle
                    var particle = new Particle();
                    var pos      = Entity.Position + Position + Calc.Random.Range(-Range, Range);
                    if (Direction.HasValue)
                    {
                        particle = Type.Create(ref particle, pos, Direction.Value);
                    }
                    else
                    {
                        particle = Type.Create(ref particle, pos);
                    }
                    particle.Track = Track;

                    // simulate for a duration
                    var simulateFor = duration - Interval * i;
                    if (particle.SimulateFor(simulateFor))
                    {
                        System.Add(particle);
                    }
                }
            }
        }
コード例 #2
0
 public void Emit(ParticleType type, Entity track, int amount, Vector2 position, Vector2 positionRange, float direction)
 {
     for (int i = 0; i < amount; i++)
     {
         type.Create(ref particles[nextSlot], track, Calc.Random.Range(position - positionRange, position + positionRange), direction, type.Color);
         nextSlot = (nextSlot + 1) % particles.Length;
     }
 }
コード例 #3
0
 public void Emit(ParticleType type, Vector2 position)
 {
     type.Create(ref particles[nextSlot], position);
     nextSlot = (nextSlot + 1) % particles.Length;
 }
コード例 #4
0
 public void Emit(ParticleType type, Vector2 position, Color color, float direction)
 {
     type.Create(ref particles[nextSlot], position, color, direction);
     nextSlot = (nextSlot + 1) % particles.Length;
 }
コード例 #5
0
 public void Emit(ParticleType type, Vector2 position, float direction)
 {
     type.Create(ref particles[nextSlot], position, direction);
     nextSlot = (nextSlot + 1) % particles.Length;
 }
コード例 #6
0
ファイル: ParticleSystem.cs プロジェクト: saint11/oldskull
 public void Emit(ParticleType type, Vector2 position, float direction)
 {
     particles[GetParticleSlot()] = type.Create(position, direction);
 }