I prefer to overwrite a statehandler-method like onState to implement my behaviour. For instance:
public interface StateBase{ void onState();}public class AfraidState : StateBase{ ... public void onState() { // implement behaviour } }
So you can add new state-implementations just by building new StateClass derived from the interface StateBase. If you are using a switch-statement you have to touch a lot of places in your code.
I am not quite sure if your first approach should descripe something similar to this, maybe the approach was the same.
With best regards,
Kimmi
A complicate solution may indicate a not understood problem.
[twitter]KimKulling[/twitter]