Exemplo n.º 1
0
        public void RegisterTransition(ITransition transition)
        {
            var t = transition.GetType();

            if (_availableTransitions.ContainsKey(t))
            {
                throw new InvalidOperationException("Transition Type alread exists");
            }
            if (transition == null)
            {
                throw new ArgumentNullException("transition");
            }

            _availableTransitions.Add(t, transition);
        }
Exemplo n.º 2
0
 // Change state based on the transition
 public override void ChangeState(ITransition transition)
 {
     Console.WriteLine("StateMachine: Transition " + transition.GetType().Name);
     base.ChangeState(transition); // Calls GetDistination State
 }