public void Update()
        {
            ChangeState(PendingState);

            Debug.Log(CurrentState);
            CurrentState.Update();

            ChangeState(PendingState);
        }
예제 #2
0
        /// <summary>
        /// 设置某个条件值,实现状态跳转
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public void SetValue <T>(string name, T value)
        {
            foreach (var item in _stateDict)
            {
                item.Value.SetValue <T>(name, value);
            }

            if (_current != null)
            {
                State state = _current;
                while (state != null)
                {
                    state = state.Update();
                    if (state != null)
                    {
                        _current = state;
                        Debug.Log("state change to :" + _current.ToString());
                    }
                }
            }
        }