// Update is called once per frame void Update() { // Easier than pressing the actual button :-) // Should make recording training data more pleasant. if (carController.getSaveStatus()) { SaveStatus_Text.text = "Capturing Data: " + (int)(100 * carController.getSavePercent()) + "%"; //Debug.Log ("save percent is: " + carController.getSavePercent ()); } else if (saveRecording) { SaveStatus_Text.text = ""; recording = false; RecordingPause.SetActive(false); RecordStatus_Text.text = "RECORD"; saveRecording = false; } if (Input.GetKeyDown(KeyCode.R) || GamepadButtonReleased("B Button")) // B Button is Red - Record { ToggleRecording(); } if (Input.GetKeyDown(KeyCode.Space) || GamepadButtonReleased("A Button")) // A Button is Green - Cruise Control { ToggleCruise(); } // save car's current location if (GamepadButtonReleased("X Button")) // X Button is Blue { carController.GetTransform(out saved_position, out saved_rotation); Debug.Log("Saving Location at: " + saved_position + " | " + saved_rotation); } // restore car's previous location if (GamepadButtonReleased("Y Button")) // Y Button is Yellow -- Caution! { carController.JumpTo(saved_position, saved_rotation); Debug.Log("Jumping to : " + saved_position + " | " + saved_rotation); } // bump the max speed up and down int dPadStatus = GamepadDpadReleased("Vertical - DPad"); if (dPadStatus != 0) { float newSpeed = carController.incrementSpeed(dPadStatus > 0 ? 1.0f : -1.0f); Debug.Log("Maxspeed set to : " + newSpeed); } Cruise_Text.text = carController.Cruising ? "Cruise (" + carController.MaxSpeed + " MPH)" : ""; // nudge the car left and right dPadStatus = GamepadDpadReleased("Horizontal - DPad"); float bump = 0.5f; if (dPadStatus != 0) { if (dPadStatus > 0) { carController.BumpLeft(bump); } else { carController.BumpRight(bump); } Debug.Log("Car bumped by : " + bump); } if (!isTraining) { if ((Input.GetKey(KeyCode.W)) || (Input.GetKey(KeyCode.S))) { DriveStatus_Text.color = Color.red; DriveStatus_Text.text = "Mode: Manual"; } else { DriveStatus_Text.color = Color.white; DriveStatus_Text.text = "Mode: Autonomous"; } } if (Input.GetKeyDown(KeyCode.Escape)) { //Do Menu Here SceneManager.LoadScene("MenuScene"); } if (Input.GetKeyDown(KeyCode.Return)) { //Do Console Here } UpdateCarValues(); }