void OnEndFrameRendering(ScriptableRenderContext context, Camera[] cameras) { if (socket == null || !socket.IsConnected()) { return; } if (!read) { //Debug.Log("Duplicate read call"); return; } read = false; c.DoRead(); }
private void ProcessBotCommands() { if (socket == null) { return; } if (!socket.IsConnected()) { Destroy(gameObject); } foreach (var command in socket.ReceiveCommands()) { botCommandLogger.LogCommand(this.CarInfo, command); lastBotCommandTime = Time.time; //Debug.Log("Processing " + JsonUtility.ToJson(command)); if (command.action == "forward") { brake = 0; forward = command.value; } else if (command.action == "reverse") { brake = 0; forward = 0; } else if (command.action == "brake") { forward = 0; brake = command.value; } else if (command.action == "turn") { targetAngle = -command.value; // bot uses -1 right, +1 left } } }