Skip to content

Commit 16a00a4

Browse files
committed
2 parents 22aba7b + ac98498 commit 16a00a4

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

MonoGameStateMachine/MonoGameStateMachine.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
<None Include="app.config" />
101101
<None Include="packages.config" />
102102
</ItemGroup>
103+
<ItemGroup>
104+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
105+
</ItemGroup>
103106
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104107
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
105108
Other similar extension points exist, see Microsoft.Common.targets.

StateMachine/Fluent/Api/FluentImplementation.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public class FluentImplementation<TS, TT, TD> : GlobalTransitionBuilderFluent<TS
4444
protected Dictionary<Tuple<TS>, StateModel<TS, TT, TD>> stateModels =
4545
new Dictionary<Tuple<TS>, StateModel<TS, TT, TD>>();
4646

47-
protected Dictionary<Tuple<TS, TS>, TransitionModel<TS, TT, TD>> transitionModels =
48-
new Dictionary<Tuple<TS, TS>, TransitionModel<TS, TT, TD>>();
47+
protected Dictionary<Tuple<TS, TS>, TransitionModel<TS, TT>> transitionModels =
48+
new Dictionary<Tuple<TS, TS>, TransitionModel<TS, TT>>();
4949

50-
protected Dictionary<Tuple<TS>, TransitionModel<TS, TT, TD>> globalTransitionModels =
51-
new Dictionary<Tuple<TS>, TransitionModel<TS, TT, TD>>();
50+
protected Dictionary<Tuple<TS>, TransitionModel<TS, TT>> globalTransitionModels =
51+
new Dictionary<Tuple<TS>, TransitionModel<TS, TT>>();
5252

5353
public FluentImplementation(TS startState)
5454
{
@@ -63,8 +63,7 @@ public Fsm<TS, TT, TD> Build()
6363
}
6464

6565
FsmModel.Current = FsmModel.States[startState];
66-
Fsm<TS, TT, TD> fsm = new Fsm<TS, TT, TD>(FsmModel);
67-
return fsm;
66+
return new Fsm<TS, TT, TD>(FsmModel);
6867
}
6968

7069
public StateFluent<TS, TT, TD> State(TS state)
@@ -101,8 +100,8 @@ public GlobalTransitionFluent<TS, TT, TD> GlobalTransitionTo(TS state)
101100
currentGlobalTransition = Tuple.Create(state);
102101
if (!globalTransitionModels.ContainsKey(currentGlobalTransition))
103102
{
104-
globalTransitionModels[currentGlobalTransition] =
105-
new TransitionModel<TS, TT, TD>(startState, state);
103+
globalTransitionModels[currentGlobalTransition] = new TransitionModel<TS, TT>(startState, state);
104+
new TransitionModel<TS, TT>(startState, state);
106105
FsmModel.GlobalTransitions[state] =
107106
new Transition<TS, TT, TD>(globalTransitionModels[currentGlobalTransition]);
108107
}
@@ -127,7 +126,7 @@ public TransitionFluent<TS, TT, TD> TransitionTo(TS state)
127126
currentTransition = Tuple.Create(currentState.Item1, state);
128127
if (!transitionModels.ContainsKey(currentTransition))
129128
{
130-
transitionModels[currentTransition] = new TransitionModel<TS, TT, TD>(currentState.Item1,
129+
transitionModels[currentTransition] = new TransitionModel<TS, TT>(currentState.Item1,
131130
state);
132131
stateModels[currentState].Transitions[state] =
133132
new Transition<TS, TT, TD>(transitionModels[currentTransition]);

StateMachine/NUnitTests/FluentTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void WhenStateChangesOnEnterAndOnExitHooksShouldTrigger()
129129
Assert.That(button.OldState, Is.EqualTo(State.REFRESHING));
130130

131131
// Update was triggered twice over all states.
132-
Assert.That(button.UpdateCounter, Is.EqualTo(2F));
132+
Assert.That(button.UpdateCounter, Is.EqualTo(2));
133133
}
134134
}
135135
}

StateMachine/StateMachine.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
<ItemGroup>
7676
<None Include="packages.config" />
7777
</ItemGroup>
78+
<ItemGroup>
79+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
80+
</ItemGroup>
7881
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7982
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8083
Other similar extension points exist, see Microsoft.Common.targets.

StateMachine/Transition.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace StateMachine
3535
[PublicAPI]
3636
public class Transition<TS, TT, TD>
3737
{
38-
private TransitionModel<TS, TT, TD> Model { get; set; }
38+
private TransitionModel<TS, TT> Model { get; set; }
3939

4040
public TS Target => Model.Target;
4141

@@ -47,7 +47,7 @@ public TS Source
4747
set { Model.Source = value; }
4848
}
4949

50-
public Transition(TransitionModel<TS, TT, TD> model)
50+
public Transition(TransitionModel<TS, TT> model)
5151
{
5252
Model = model;
5353
}
@@ -57,7 +57,7 @@ public Transition(Collection<TT> triggers, TS source, TS target)
5757
{
5858
if (target == null) throw FsmBuilderException.TargetStateCannotBeNull();
5959

60-
Model = new TransitionModel<TS, TT, TD>(source, target);
60+
Model = new TransitionModel<TS, TT>(source, target);
6161
Model.Triggers.UnionWith(triggers);
6262
}
6363

StateMachine/TransitionModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
namespace StateMachine
3434
{
3535
[PublicAPI]
36-
public class TransitionModel<TS, TT, TD>
36+
public class TransitionModel<TS, TT>
3737
{
3838
public ISet<TT> Triggers { get; set; } = new HashSet<TT>();
3939
public TS Source { get; set; }

0 commit comments

Comments
 (0)