mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 02:27:08 +02:00
* 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.
36 lines
961 B
C#
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);
|
|
}
|
|
}
|
|
}
|