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