Defining a character's temperament and possible actions in the form of a finite state machine is a simple but effective way to simulate emotion, personality, and those subtle quirks that hint at humanity.
In this recipe, we're going to create a pretty simple example in the form of a security guard who gets progressively more or less excitable depending on whether he can hear or see the hero of the game.
Just like a real person might react, the guard doesn't instantly jump into full-blown anger upon the smallest noise, nor does he instantly calm down upon losing sight of the hero.
This recipe requires only an XNA-compatible font of your choosing.
To create your own character state machine: