blob: d5ac2f82da7bed048098a5383ba5c319d8f4d196 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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");
}
}
}
}
|