major rework

This commit is contained in:
max
2026-02-16 18:32:48 +01:00
parent bbd82da07e
commit 932734e5b4
24 changed files with 1706 additions and 893 deletions

View File

@@ -0,0 +1,30 @@
using Car_simulation.Core.Physics;
namespace Car_simulation.Core.Components
{
public class BrakeSystem : ICarComponent
{
public float BrakeInput { get; set; } = 0f;
public float MaxBrakeTorque { get; set; } = 3000f;
private WheelSystem _wheelSystem;
public BrakeSystem(WheelSystem wheelSystem)
{
_wheelSystem = wheelSystem;
}
public void Update(float deltaTime)
{
if (BrakeInput <= 0) return;
float brakeTorque = BrakeInput * MaxBrakeTorque;
_wheelSystem.ApplyTorque(-brakeTorque, deltaTime);
}
public float GetBrakeTorque()
{
return BrakeInput * MaxBrakeTorque;
}
}
}