
using UnityEngine;

public class SimpleLaneFollowingBehavior : ICarBehavior
{
    
    public static readonly SimpleLaneFollowingBehavior Instance = new SimpleLaneFollowingBehavior();
    
    public void UpdateBehavior(TrafficCar car)
    {
        car.transform.Translate(Vector3.forward * car.forwardSpeed * Time.deltaTime);

        Vector3 newPos = car.transform.position;
        newPos.x = Mathf.Lerp(newPos.x, car.TargetX, Time.deltaTime * car.laneChangeSpeed);
        car.transform.position = newPos;
    }
}
