예제 #1
0
        public void ChangeState <TState>(AFsm <T> fsm) where TState : AFsmState <T>
        {
            AFsm <T> fsmImplement = (AFsm <T>)fsm;

            if (fsmImplement == null)
            {
                throw new GameFrameworkException("FSM is invalid.");
            }

            fsmImplement.ChangeState <TState>();
        }
예제 #2
0
        public void ChangeState(AFsm <T> fsm, Type stateType)
        {
            AFsm <T> fsmImplement = (AFsm <T>)fsm;

            if (fsmImplement == null)
            {
                throw new GameFrameworkException("FSM is invalid.");
            }

            if (stateType == null)
            {
                throw new GameFrameworkException("State type is invalid.");
            }

            if (!typeof(AFsmState <T>).IsAssignableFrom(stateType))
            {
                throw new GameFrameworkException(string.Format("State type '{0}' is invalid.", stateType.FullName));
            }

            fsmImplement.ChangeState(stateType);
        }