2525// For more information, please refer to <http://unlicense.org>
2626// ***************************************************************************
2727
28+ using System ;
29+ using System . Collections . Generic ;
2830using JetBrains . Annotations ;
2931using Microsoft . Xna . Framework ;
3032using MonoGameStateMachine . Api ;
3436namespace MonoGameStateMachine
3537{
3638 [ PublicAPI ]
37- public class Fsm < TS , TT > : StateMachine . Fsm < TS , TT , GameTime >
39+ public class Fsm < TS , TT > : Fsm < TS , TT , GameTime >
3840 {
3941 public Fsm ( FsmModel < TS , TT , GameTime > model ) : base ( model )
4042 {
@@ -45,36 +47,32 @@ public Fsm(State<TS, TT, GameTime> current, bool stackEnabled = false) : base(cu
4547 }
4648
4749 /// <summary>
48- /// Gets you a builder for a Finite-State-Machine (FSM).
50+ /// Gets you a builder for a Finite-State-Machine (FSM).
4951 /// </summary>
5052 /// <param name="startState">The start state's key.</param>
5153 /// <returns></returns>
5254 public new static BuilderFluent < TS , TT , GameTime > Builder ( TS startState )
5355 {
5456 return new FluentImplementation < TS , TT , GameTime > ( startState ) ;
5557 }
56-
57- public new void Update ( GameTime gameTime )
58- {
59- Model . Current . RaiseUpdated ( new UpdateArgs < TS , TT , GameTime > ( this , Current , gameTime ) ) ;
60- }
6158 }
6259
6360 [ PublicAPI ]
64- public class Fsm < TS , TT , TD > : StateMachine . Fsm < TS , TT , DataObject < TD > >
61+ public class Fsm < TS , TT , TD > : StateMachine . Fsm < TS , TT , TD >
6562 {
66-
63+ public Dictionary < Tuple < TS , TS > , List < Timer > > AfterEntries { get ; set ; } = new Dictionary < Tuple < TS , TS > , List < Timer > > ( ) ;
64+ public Dictionary < Tuple < TS > , List < Timer > > GlobalAfterEntries { get ; set ; } = new Dictionary < Tuple < TS > , List < Timer > > ( ) ;
6765
68- public Fsm ( FsmModel < TS , TT , DataObject < TD > > model ) : base ( model )
66+ public Fsm ( FsmModel < TS , TT , TD > model ) : base ( model )
6967 {
7068 }
7169
72- public Fsm ( State < TS , TT , DataObject < TD > > current , bool stackEnabled = false ) : base ( current , stackEnabled )
70+ public Fsm ( State < TS , TT , TD > current , bool stackEnabled = false ) : base ( current , stackEnabled )
7371 {
7472 }
75-
73+
7674 /// <summary>
77- /// Gets you a builder for a Finite-State-Machine (FSM).
75+ /// Gets you a builder for a Finite-State-Machine (FSM).
7876 /// </summary>
7977 /// <param name="startState">The start state's key.</param>
8078 /// <returns></returns>
@@ -83,9 +81,32 @@ public Fsm(State<TS, TT, DataObject<TD>> current, bool stackEnabled = false) : b
8381 return new FluentImplementation < TS , TT , DataObject < TD > > ( startState ) ;
8482 }
8583
86- public new void Update ( DataObject < TD > gameTime )
84+ public new void Update ( TD data )
8785 {
88- Model . Current . RaiseUpdated ( new UpdateArgs < TS , TT , DataObject < TD > > ( this , Current , gameTime ) ) ;
86+ List < Timer > l ;
87+ if ( ! AfterEntries . TryGetValue ( Current , out l ) )
88+ {
89+ l = new List < Tuple < float , TimeUnit > > ( ) ;
90+ AfterEntries . Add ( key , l ) ;
91+ }
92+ l . Add ( new Tuple < float , TimeUnit > ( amount , timeUnit ) ) ;
93+
94+ foreach ( var e in GlobalAfterEntries )
95+ {
96+ var target = e . Key ;
97+ var ts = e . Value ;
98+ foreach ( var t in ts )
99+ {
100+
101+ }
102+ }
103+ if ( ! GlobalAfterEntries . TryGetValue ( key , out l ) )
104+ {
105+ l = new List < Tuple < float , TimeUnit > > ( ) ;
106+ GlobalAfterEntries . Add ( key , l ) ;
107+ }
108+
109+ Model . Current . RaiseUpdated ( new UpdateArgs < TS , TT , TD > ( this , Current , data ) ) ;
89110 }
90111 }
91112}
0 commit comments