private void Update() { if (trafficLight == null || ai == null) { return; } if (trafficLight.status == TrafficLightStatus.Stop) { ai.HoldBrake(); return; } ai.ReleaseBrake(); RemoveTrafficLight(); }
private void FixedUpdate() { CastRay(); ai.ReleaseBrake(); if (shouldStop) { ai.HoldBrake(); } else { ai.ReleaseBrake(); } if (trafficLight == null) { return; } if (trafficLight.status == TrafficLightStatus.Go) { ai.ReleaseBrake(); RemoveTrafficLight(); return; } ai.HoldBrake(); }