Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/StressTestMovementSystem.cs
metalgearsloth 684ec60be6 Pausing content (#3061)
* Change EntityQuery to not retrieve paused by default

* GetAllComponents

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2021-02-04 00:20:48 +11:00

35 lines
1.0 KiB
C#

using System;
using Content.Server.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Maths;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
internal sealed class StressTestMovementSystem : EntitySystem
{
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var stressTest in ComponentManager.EntityQuery<StressTestMovementComponent>(true))
{
var transform = stressTest.Owner.Transform;
stressTest.Progress += frameTime;
if (stressTest.Progress > 1)
{
stressTest.Progress -= 1;
}
var x = MathF.Sin(stressTest.Progress * MathHelper.TwoPi);
var y = MathF.Cos(stressTest.Progress * MathHelper.TwoPi);
transform.WorldPosition = stressTest.Origin + (new Vector2(x, y) * 5);
}
}
}
}