mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-22 18:29:30 +00:00
168d8fbc36
* 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
43 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|