Beispiel #1
0
 protected virtual void Awake()
 {
     m_States = GetComponentsInChildren <hwmFSMState>(true);
     for (int iState = 0; iState < m_States.Length; iState++)
     {
         hwmFSMState iterState = m_States[iState];
         hwmDebug.Assert(iterState.SupportInstantlyChange() || iterState.SupportCoroutineChange()
                         , string.Format("State ({0}) not support change", iterState.StateName)
                         , gameObject);
         iterState.Initialize(this);
     }
 }
Beispiel #2
0
    public IEnumerator ChangeState_Co(hwmFSMState newState)
    {
        ChangeStart(newState);

        if (m_ChangeFromState != null)
        {
            hwmDebug.Assert(m_ChangeFromState.SupportCoroutineChange(), "ChangeFromState not support coroutine change", gameObject);
            yield return(StartCoroutine(m_ChangeFromState.Deactivate_Co()));
        }

        m_CurrentState = null;

        if (m_ChangeToState != null)
        {
            hwmDebug.Assert(m_ChangeToState.SupportCoroutineChange(), "m_ChangeToState not support coroutine change", gameObject);
            yield return(StartCoroutine(m_ChangeToState.Activate_Co()));
        }

        ChangeFinished();
    }