moved the particle system and the entity component system into their own nuget packages

This commit is contained in:
Dylan Wilson
2017-03-07 22:08:31 +10:00
parent 1b6df14681
commit c236e6dfd5
71 changed files with 422 additions and 83 deletions
@@ -0,0 +1,29 @@
using Microsoft.Xna.Framework;
namespace MonoGame.Extended.Particles.Modifiers
{
public unsafe class VortexModifier : IModifier
{
// Note: not the real-life one
private const float _gravConst = 100000f;
public Vector2 Position { get; set; }
public float Mass { get; set; }
public float MaxSpeed { get; set; }
public void Update(float elapsedSeconds, ParticleBuffer.ParticleIterator iterator)
{
while (iterator.HasNext)
{
var particle = iterator.Next();
var diff = Position + particle->TriggerPos - particle->Position;
var distance2 = diff.LengthSquared();
var speedGain = _gravConst*Mass/distance2*elapsedSeconds;
// normalize distances and multiply by speedGain
diff.Normalize();
particle->Velocity += diff*speedGain;
}
}
}
}