Files
Christopher Whitley 168d8fbc36 High-Performance Particle System Rewrite (#990)
* Refactor particle system

* Use correct alloc

* Use original ParticleIterator imlementation for zero allications.

* Move ParticleIterator to its own class instead of a nested class

* Mark nullable

* Add fallback mechanism for loading textures when it's an image file and not an xnb
2025-05-28 15:57:58 -04:00

43 lines
1.1 KiB
C#

using System;
using Microsoft.Xna.Framework;
using MonoGame.Extended.Particles.Profiles;
namespace MonoGame.Extended.Tests.Particles.Profiles
{
public class RingProfileTests
{
[Fact]
public unsafe void ReturnsOffsetEqualToRadius()
{
RingProfile subject = new RingProfile
{
Radius = 10f
};
Vector2 offset;
Vector2 heading;
subject.GetOffsetAndHeading(&offset, &heading);
double length = Math.Sqrt(offset.X * offset.X + offset.Y * offset.Y);
Assert.Equal(10.0f, length, precision: 5);
}
[Fact]
public unsafe void WhenRadiateIsTrue_HeadingIsEqualToNormalizedOffset()
{
RingProfile subject = new RingProfile
{
Radius = 10f,
Radiate = CircleRadiation.Out
};
Vector2 offset;
Vector2 heading;
subject.GetOffsetAndHeading(&offset, &heading);
Assert.Equal(heading.X, offset.X / 10, precision: 5);
Assert.Equal(heading.Y, offset.Y / 10, precision: 5);
}
}
}