public int ChangeState(string targetStateName, object parameters)
    {
        if (!allState.ContainsKey(targetStateName))
        {
            return(1);
        }

        string curStateName = _curState != null?_curState.GetName() : string.Empty;

        if (curStateName == targetStateName)
        {
            return(2);
        }

        if (_curState != null)
        {
            _curState.OnExit(targetStateName);
        }

        allState[targetStateName].OnEnter(curStateName, parameters);

        _curState = allState[targetStateName];

        return(0);
    }
    public bool RegisterState(ICommonState IState, object parameters)
    {
        string stateName = IState.GetName();

        if (allState.ContainsKey(stateName))
        {
            return(false);
        }

        IState.Init(parameters);

        allState.Add(stateName, IState);

        return(true);
    }