Beispiel #1
0
        public bool Equals(StateTransition <T> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(mInitState.Equals(other.GetInitState()) && mEndState.Equals(other.GetEndState()));
        }
Beispiel #2
0
        // 상태 전이 등록
        public void AddTransition(T init, T end,
                                  Callback _callback_excute,
                                  Callback _callback_exit  = null,
                                  Callback _callback_enter = null,
                                  IEnumerable _routine     = null)
        {
            StateTransition <T> tr = new StateTransition <T>(init, end);

            if (mTransExcute.ContainsKey(tr))
            {
                Debug.LogErrorFormat("[FSM] Transition: {0} - {1} exists already.", tr.GetInitState(), tr.GetEndState());
                return;
            }

            mTransEnter.Add(tr, _callback_enter);
            mTransExcute.Add(tr, _callback_excute);
            mTransExit.Add(tr, _callback_exit);
            mTransEnumerator.Add(tr, _routine);

            //Debug.Log("[FSM] Added transition " + mTransExcute.Count + ": " + tr.GetInitState() + " - " + tr.GetEndState() + ", Callback: " + _callback_excute);
        }