Esempio n. 1
0
		public void PushState(string stateName)
		{
			if (ActiveChild != null)
			{
				ActiveChild.Exit();
			}

			State state;
			if (!_children.TryGetValue(stateName, out state))
			{
				throw new KeyNotFoundException("Tried to push to state \"" + stateName + "\", but it is not in the list of children. State: \"" + Name + "\"");
			}

			if (!Root.CanTransitSelf && this == state) return;

			ActiveChild = state;
			Root.SetCurrentState(ActiveChild);
			ActiveChild.Enter();
		}