AI Command Lab // Flight Simulator
200E: The Control Yoke
Initial AI Output (Fragile)
// AI-Generated Code: Old & Rigid
void Update() {
// Audit Fail: What if the player uses a gamepad?
// What if they want to rebind Jump to 'Z'?
if (Input.GetKeyDown(KeyCode.Space)) {
Jump();
}
}
Initial AI Prompt
"You ask the AI: "Jump when the player presses Space.""
Pilot Comm Link
Mission Objective: A skilled Architect directs the AI to use Action Maps. You command: "Use the Unity Input System via 'InputAction.CallbackContext' to handle the Jump event."
Optimized Protocol
// Corrected: Device Agnostic
public void OnJump(InputAction.CallbackContext context) {
if (context.performed) {
Jump();
}
}
// Now Space, 'A', or a Touch Screen tap all trigger this.