public void Reset() { m_taskEngine.TaskStateChanged -= OnTaskStateChanged; m_playerView.UnitCreated -= OnUnitCreated; m_playerView.UnitRemoved -= OnUnitRemoved; m_playerView.AssetCreated -= OnAssetCreated; m_playerView.AssetRemoved -= OnAssetRemoved; foreach (RunningTaskInfo task in m_state.TaskIdToTask.Values) { TaskInfo taskInfo = m_taskEngine.TerminateTask(task.TaskId); m_state.TaskTemplates[task.Type].Release(taskInfo); } m_taskEngine.TerminateAll(); m_state.TaskIdToTask.Clear(); m_state.UnitIdToTask.Clear(); m_state.BusyUnits.Clear(); m_state.FreeUnits.Clear(); }