示例#1
0
		public void Exit()
		{
			IsActive = false;

			if (ActiveChild != null)
			{
				ActiveChild.Exit();
				ActiveChild = null;
			}

			if (_exitAction != null)
			{
				_exitAction();
			}
		}
示例#2
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();
		}