1
2
3
4
5
|
public delegate void EnterState(string stateName);
public delegate void PushState(string stateName, string lastStateName);
public delegate void PopState();
|
1
2
3
|
protected Dictionary<string, FSState> mStates;
protected Stack<FSState> mStateStack;
|
1
2
3
4
5
6
7
8
9
|
public void Register( string stateName, IState stateObject) {
if (mStates.Count == 0)
mEntryPoint = stateName;
mStates.Add(stateName, new FSState(stateObject, this , stateName, Enter, Push, Pop));
}
上面整个FSMStateMachine类就封装完了,要知后事如何?且看系列三的讲解。 转自:http://jxwgame.blog.51cto.com/943299/1609539 |