void Update()
 {
     if (_radar.objectDetected)
     {
         if (_radar.Distance <= closeDistance)
         {
             _drive.Brake();
             Debug.Log("Close");
         }
         else if (_radar.Distance <= normalDistance)
         {
             Debug.Log("Normal");
         }
         else if (_radar.Distance <= farDistance)
         {
             Debug.Log("Far");
         }
     }
     else
     {
         Debug.Log("No objects deteceted");
     }
 }
示例#2
0
文件: Car.cs 项目: piekaa/offroad
 public void Brake(float throttle)
 {
     Drive.Brake(throttle);
 }