Files
RobustToolbox/Robust.Client/Physics/PhysicsSystem.cs
T
AcruidandGitHub 2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00

36 lines
961 B
C#

using System;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Timing;
namespace Robust.Client.Physics
{
[UsedImplicitly]
public class PhysicsSystem : SharedPhysicsSystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
private TimeSpan _lastRem;
public override void Update(float frameTime)
{
_lastRem = _gameTiming.CurTime;
SimulateWorld(frameTime, !_gameTiming.InSimulation || !_gameTiming.IsFirstTimePredicted);
}
public override void FrameUpdate(float frameTime)
{
if (_lastRem > _gameTiming.TickRemainder)
{
_lastRem = TimeSpan.Zero;
}
var diff = _gameTiming.TickRemainder - _lastRem;
_lastRem = _gameTiming.TickRemainder;
SimulateWorld((float) diff.TotalSeconds, true);
}
}
}