public void TransTo(int iLevel, IHierarchicalState oState) { if (m_bTerminated) { Debugger.LogError("[StateController] has been terminated"); return; } if (!m_bStarted) { Debugger.LogError("[StateController] need to be started first"); return; } if (iLevel > m_oCurrentState.Count) { Debugger.LogError("[StateController] Level is too big"); return; } Debugger.Log(string.Format("[StateController] Level {0:} transTo: {1:}", iLevel, oState.ToString())); if (iLevel == m_oCurrentState.Count) { m_oCurrentState.Add(oState); m_oCurrentState [iLevel].SetProperty(this, iLevel); } else { for (int i = m_oCurrentState.Count - 1; i >= iLevel; i--) { m_oCurrentState [i].StateEnd(); m_oCurrentState.RemoveAt(i); } m_oCurrentState.Add(oState); m_oCurrentState [iLevel].SetProperty(this, iLevel); } }
public void TransTo(int iLevel, IHierarchicalState oState, string sSceneName = "", bool bReload = false) { if (sSceneName != "") { m_SceneController.LoadScene(sSceneName, bReload); } m_StateController.TransTo(iLevel, oState); }
public void Start(IHierarchicalState oState) { if (m_bTerminated) { Debugger.LogError("[HStateController] has been terminated"); return; } if (m_bStarted) { Debugger.LogError("[HStateController] has been started"); return; } Debugger.Log("[HStateController] Start: " + oState.ToString()); m_bStarted = true; m_oCurrentState.Add(oState); m_oCurrentState[0].SetProperty(this, 0); }
public void Start(IHierarchicalState oState) { m_StateController.Start(oState); }
protected void AddSubState(IHierarchicalState oState) { m_StateController.TransTo(m_iLevel + 1, oState); }
protected void TransTo(int iLevel, IHierarchicalState oState) { m_StateController.TransTo(iLevel, oState); }
public HierarchicalStateController(IHierarchicalState oStartState) : this() { Start(oStartState); }