Writing a State Machine

Hi,
I need to write a state machine, most likely hierarchical, for enemy behavior in a game I am working on. I am unsure of how to structure this. Do I simply need methods for each state, or have a new script file for each state? Is there a good example I can follow to get myself off the ground?

Thanks

Somebody didn’t use the search function or even bother to Google state machines, here’s a bone to gnaw on:

http://forum.unity3d.com/threads/38956-Very-Simple-StateMachine-Pattern-C
http://code.google.com/p/stateless/

There are many possible approaches and some elaborate frameworks out there, but I usually do something simple, have a coroutine for each state, all in the same script - http://drupal.technicat.com/games/unity/scripts/fsm.html