State-based elevator controller