Skip to content

Commit 18fe90d

Browse files
Update README.md
1 parent 00596d0 commit 18fe90d

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Useful extensions for work:
2424

2525
## Examples:
2626

27-
**Structure**
27+
### Structure ###
2828
```C#
2929
StateMachine stateMachine = new StateMachine();
3030

@@ -46,36 +46,39 @@ Useful extensions for work:
4646
Transition transition3 = state4.AddTransitionToThis("Transition3", state3);
4747

4848
//Add action on entry or/and exit
49-
state1.OnExit(Method1);
50-
state2.OnEntry(Method2);
51-
state3.OnExit(Method3);
52-
state4.OnExit(Method4);
49+
state1.OnExit(Action1);
50+
state2.OnEntry(Action2);
51+
state3.OnExit(Action3);
52+
state4.OnExit(Action4);
5353

5454
//Set start state
5555
state1.SetAsStartState();
5656

5757
//Start work
5858
stateMachine.Start();
5959
```
60-
**Example methods**
60+
### Actions Syntax ###
61+
##### Action on entry/exit #####
6162
```C#
62-
static void Method1(State state, Dictionary<string, object> parameters)
63+
void ActionOnEtnry(State state, Dictionary<string, object> parameters)
6364
{
65+
//you need invoke transition in entry or exit action, differently work state machine will be end
6466
state.StateMachine.InvokeTransition("Transition1");
6567
}
66-
67-
static void Method2(State state, Dictionary<string, object> parameters)
68-
{
69-
state.StateMachine.InvokeTransition("Transition2");
70-
}
71-
72-
static void Method3(State state, Dictionary<string, object> parameters)
68+
69+
```
70+
##### Action on change state #####
71+
```C#
72+
void ActionOnChangeState(State stateFrom, State stateTo)
7373
{
74-
state.StateMachine.InvokeTransition("Transition3");
74+
7575
}
76-
77-
static void Method4(State state, Dictionary<string, object> parameters)
76+
```
77+
##### Action on transition invoke #####
78+
```C#
79+
void ActionOnTransitionInvoke(Transition transition, Dictionary<string, object> parameters)
7880
{
7981

8082
}
8183
```
84+

0 commit comments

Comments
 (0)