From acea7b2e728787a0d83bbf83c8c1f042d2c32e7e Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 3 Jun 2024 10:15:45 +0800 Subject: + plugins project --- .../Profiles/RingProfile.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs (limited to 'Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/Profiles/RingProfile.cs') 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 -- cgit v1.1-26-g67d0