mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-26 00:45:20 +00:00
Move source projects into source directory
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a modifier which interpolates the color of a particle over the course of its lifetime.
|
||||
/// </summary>
|
||||
public sealed class ColorInterpolator : Interpolator<HslColor>
|
||||
{
|
||||
public override unsafe void Update(float amount, Particle* particle)
|
||||
{
|
||||
particle->Color = HslColor.Lerp(StartValue, EndValue, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using MonoGame.Extended;
|
||||
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
public class HueInterpolator : Interpolator<float>
|
||||
{
|
||||
public override unsafe void Update(float amount, Particle* particle)
|
||||
{
|
||||
particle->Color = new HslColor((EndValue - StartValue) * amount + StartValue, particle->Color.S, particle->Color.L);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
public abstract class Interpolator
|
||||
{
|
||||
protected Interpolator()
|
||||
{
|
||||
Name = GetType().Name;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public abstract unsafe void Update(float amount, Particle* particle);
|
||||
}
|
||||
|
||||
public abstract class Interpolator<T> : Interpolator
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the intial value when the particles are created.
|
||||
/// </summary>
|
||||
public virtual T StartValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the final value when the particles are retired.
|
||||
/// </summary>
|
||||
public virtual T EndValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
public class OpacityInterpolator : Interpolator<float>
|
||||
{
|
||||
public override unsafe void Update(float amount, Particle* particle)
|
||||
{
|
||||
particle->Opacity = (EndValue - StartValue) * amount + StartValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
public class RotationInterpolator : Interpolator<float>
|
||||
{
|
||||
public override unsafe void Update(float amount, Particle* particle)
|
||||
{
|
||||
particle->Rotation = (EndValue - StartValue) * amount + StartValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
public class ScaleInterpolator : Interpolator<Vector2>
|
||||
{
|
||||
public override unsafe void Update(float amount, Particle* particle)
|
||||
{
|
||||
particle->Scale = (EndValue - StartValue) * amount + StartValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
|
||||
{
|
||||
public class VelocityInterpolator : Interpolator<Vector2>
|
||||
{
|
||||
public override unsafe void Update(float amount, Particle* particle)
|
||||
{
|
||||
particle->Velocity = (EndValue - StartValue) * amount + StartValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user