public void AdvanceTime(double time) { if (!m_update || !this.gameObject.activeSelf) { return; } if (m_nextStateID != 0) { m_currentState.Stop(); m_currentState.gameObject.SetActive(false); m_lastStateID = m_currentStateID; m_currentStateID = m_nextStateID; m_currentState = m_states[m_nextStateID]; m_currentState.Play(); m_currentState.gameObject.SetActive(true); #if UNITY_EDITOR SetNameOfCurrentState(); #endif //UNITY_EDITOR m_nextStateID = 0; } m_currentState.AFUpdate(time); }
public void Add(int name, AMovieClip state, bool defaultState = false) { if (m_states.ContainsKey(name)) { throw new Exception("The State " + name + " already was created"); } state.transform.parent = this.gameObject.transform; if (!defaultState) { state.Stop(); } else { if (m_defaultStateID != 0) { UnityEngine.Debug.LogWarning("The default state was changed to <" + name + ">"); } m_defaultStateID = name; m_lastStateID = name; state.Play(); } state.gameObject.SetActive(defaultState); m_currentState = state; m_currentStateID = name; m_states.Add(name, state); #if UNITY_EDITOR SetNameOfCurrentState(); #endif //UNITY_EDITOR }
public void Play() { m_update = true; m_currentState.Play(); }