game(ai): linq the foreach in Steering()

This commit is contained in:
Mark Joshwel 2024-08-10 02:28:26 +08:00
parent e38602910d
commit 327d51a7e3

View file

@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
/// <summary>
@ -102,8 +103,7 @@ public void Brake()
/// </summary>
public void Steering()
{
foreach (var wheel in wheels)
if (wheel.axel == Axel.Front)
foreach (var wheel in wheels.Where(wheel => wheel.axel == Axel.Front))
wheel.wheelCollider.steerAngle = _currentTurn;
}