From 327d51a7e369c81231482c6565c2c087ffb19641 Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Sat, 10 Aug 2024 02:28:26 +0800 Subject: [PATCH] game(ai): linq the foreach in Steering() --- RunningLateGame/Assets/Scripts/CarController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RunningLateGame/Assets/Scripts/CarController.cs b/RunningLateGame/Assets/Scripts/CarController.cs index d3efbff..7c5bc26 100644 --- a/RunningLateGame/Assets/Scripts/CarController.cs +++ b/RunningLateGame/Assets/Scripts/CarController.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; +using System.Linq; using UnityEngine; /// @@ -102,9 +103,8 @@ public void Brake() /// public void Steering() { - foreach (var wheel in wheels) - if (wheel.axel == Axel.Front) - wheel.wheelCollider.steerAngle = _currentTurn; + foreach (var wheel in wheels.Where(wheel => wheel.axel == Axel.Front)) + wheel.wheelCollider.steerAngle = _currentTurn; } ///