From 72d66e59841d3dd3c59a7f3c0450ce0543808cfc Mon Sep 17 00:00:00 2001 From: Sc0rch-thinks Date: Thu, 15 Aug 2024 02:31:58 +0800 Subject: [PATCH] game(scripts/carcon): interim fsm aaaaaa handover to @mark --- RunningLateGame/Assets/Scripts/CarController.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/RunningLateGame/Assets/Scripts/CarController.cs b/RunningLateGame/Assets/Scripts/CarController.cs index 665b54d..d034bcb 100644 --- a/RunningLateGame/Assets/Scripts/CarController.cs +++ b/RunningLateGame/Assets/Scripts/CarController.cs @@ -51,12 +51,12 @@ public enum Axel /// /// inputs for acceleration /// - private float _currentAcceleration; + [SerializeField] private float _currentAcceleration; /// /// inputs for turning /// - private float _currentTurn; + [SerializeField] private float _currentTurn; /// /// to move the car @@ -82,7 +82,8 @@ public void SetInputs(float forwardAmount, float turnAmount) /// public void Move() { - foreach (var wheel in wheels) wheel.wheelCollider.motorTorque = _currentAcceleration; + foreach (var wheel in wheels) + wheel.wheelCollider.motorTorque = _currentAcceleration; } /// @@ -103,8 +104,12 @@ public void Brake() /// public void Steering() { - foreach (var wheel in wheels.Where(wheel => wheel.axel == Axel.Front)) - wheel.wheelCollider.steerAngle = _currentTurn; + foreach (var wheel in wheels) + if (wheel.axel == Axel.Front) + { + wheel.wheelCollider.steerAngle = _currentTurn; + + } } ///