private int ReadSubState(int nSubSTateCnt, string path) { if (path == null || nSubSTateCnt == 0 || path == "") { Debug.LogError("SubState Init Error. SubState Info is invalid. File:" + path); return(-1); } if (nSubSTateCnt < 0 || nSubSTateCnt >= 100) { Debug.LogError("SubState Init Error. SubState Count is invalid. File:" + path); return(-1); } int ret = 0; for (int i = 0; i < nSubSTateCnt; i++) { string stateName = String.Format("State{0:00}", i); CState state = new CState(m_stateMgr, this); if (state.LoadFromFile(path, stateName)) { m_mapSubState.Add(state.type, state); ret++; } } return(ret); }