mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using System;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.Physics;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Input;
|
|
using Robust.Shared.Input.Binding;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Timing;
|
|
|
|
#nullable enable
|
|
|
|
namespace Robust.Client.GameObjects
|
|
{
|
|
/// <summary>
|
|
/// Updates the position of every Eye every frame, so that the camera follows the player around.
|
|
/// </summary>
|
|
[UsedImplicitly]
|
|
public sealed class EyeUpdateSystem : EntitySystem
|
|
{
|
|
/// <inheritdoc />
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
//WARN: Tightly couples this system with InputSystem, and assumes InputSystem exists and is initialized
|
|
CommandBinds.Builder
|
|
.Bind(EngineKeyFunctions.CameraRotateRight, new NullInputCmdHandler())
|
|
.Bind(EngineKeyFunctions.CameraRotateLeft, new NullInputCmdHandler())
|
|
.Register<EyeUpdateSystem>();
|
|
|
|
// Make sure this runs *after* entities have been moved by interpolation and movement.
|
|
UpdatesAfter.Add(typeof(TransformSystem));
|
|
UpdatesAfter.Add(typeof(PhysicsSystem));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void Shutdown()
|
|
{
|
|
//WARN: Tightly couples this system with InputSystem, and assumes InputSystem exists and is initialized
|
|
CommandBinds.Unregister<EyeUpdateSystem>();
|
|
base.Shutdown();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void FrameUpdate(float frameTime)
|
|
{
|
|
foreach (var eyeComponent in EntityManager.EntityQuery<EyeComponent>(true))
|
|
{
|
|
eyeComponent.UpdateEyePosition();
|
|
}
|
|
}
|
|
}
|
|
}
|