AI Command Lab // Flight Simulator
300B: Time-Dilation
Initial AI Output (Fragile)
// AI-Generated Code: Audit Failure (Update Clutter)
float timer = 0f;
void Update() {
// Audit Fail: This runs 60+ times a second just to check a clock!
timer += Time.deltaTime;
if (timer >= 3f) {
Shoot();
timer = 0f;
}
}
Initial AI Prompt
"You ask the AI: "Make the enemy wait 3 seconds before shooting again.""
Pilot Comm Link
Mission Objective: A skilled Navigator directs the AI to use an IEnumerator.
Optimized Protocol
// Navigator Code: Clean & Event-Based
void Start() {
StartCoroutine(ShootingRoutine());
}
IEnumerator ShootingRoutine() {
while (true) {
Shoot();
// The Navigator "sleeps" for 3 seconds here
yield return new WaitForSeconds(3f);
}
}