public void Init(Character owner) { CharacterStateMachine state = null; for (UnitStateIndex index = UnitStateIndex.Idle; index < UnitStateIndex.Max; ++index) { Util.CreateInstanceToString <CharacterStateMachine>(ref state, string.Format("{0}State", index.ToString())); state.Init(index, owner); m_states[(int)index] = state; } }