diff options
Diffstat (limited to 'Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs')
-rw-r--r-- | Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs b/Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs new file mode 100644 index 0000000..d5ac2f8 --- /dev/null +++ b/Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs @@ -0,0 +1,32 @@ +using System; +using Microsoft.Xna.Framework; + +namespace MonoGame.Extended.Particles.Profiles +{ + public class RingProfile : Profile + { + public float Radius { get; set; } + public CircleRadiation Radiate { get; set; } + + public override void GetOffsetAndHeading(out Vector2 offset, out Vector2 heading) + { + Random.NextUnitVector(out heading); + + switch (Radiate) + { + case CircleRadiation.In: + offset = new Vector2(-heading.X*Radius, -heading.Y*Radius); + break; + case CircleRadiation.Out: + offset = new Vector2(heading.X*Radius, heading.Y*Radius); + break; + case CircleRadiation.None: + offset = new Vector2(heading.X*Radius, heading.Y*Radius); + Random.NextUnitVector(out heading); + break; + default: + throw new ArgumentOutOfRangeException($"{Radiate} is not supported"); + } + } + } +}
\ No newline at end of file |