AI Command Lab // Flight Simulator
205B: The Phase Pulse
Initial AI Output (Fragile)
// AI-Generated Code: Update Polling
void Update() {
// Audit Fail: Manually tracking state variables is messy.
if (Input.GetKey(KeyCode.F)) charge += Time.deltaTime;
if (Input.GetKeyUp(KeyCode.F)) Fire(charge);
}
Initial AI Prompt
"You ask the AI: "Charge the laser while holding the button.""
Pilot Comm Link
Mission Objective: A skilled Pilot directs the AI to use Callbacks. You command: "Subscribe to the .performed and .canceled events to handle the charging logic cleanly."
Optimized Protocol
// Corrected: Event Driven
void Start() {
fireAction.performed += ctx => StartCharge();
fireAction.canceled += ctx => ReleaseCharge();
}