private void EditorManager_CustomSceneSerialization(object sender, CustomSceneSerializationArgs e)
        {
            if (e.CustomSceneObjects.IsSaving)
            {
                if (m_settingsDictionary != null)
                {
                    e.CustomSceneObjects.AddObject("HavokAiEditorPlugin.EditorPlugin", m_settingsDictionary);
                }
            }
            else
            {
                if (m_settingsDictionary != null)
                {
                    m_settingsCreatedDuringSceneLoad = true;
                }

                HavokNavMeshGlobalSettingsDictionary serializedSettingsCollection =
                    (HavokNavMeshGlobalSettingsDictionary)e.CustomSceneObjects.FindObject("HavokAiEditorPlugin.EditorPlugin", typeof(HavokNavMeshGlobalSettingsDictionary));
                if (serializedSettingsCollection != null)
                {
                    // replace with serialized copy.
                    m_settingsDictionary        = serializedSettingsCollection;
                    m_settingsDictionary.Parent = this;
                }
            }
        }
        public bool AddGlobalSettings(string settingsName, HavokNavMeshGlobalSettings settings, bool bUndoable)
        {
            if (m_settingsDictionary == null)
            {
                // create a collection if doesn't exist
                m_settingsDictionary = new HavokNavMeshGlobalSettingsDictionary(this);
            }

            if (bUndoable)
            {
                EditorManager.Actions.Add(new AddNavMeshGlobalSettingsAction(m_settingsDictionary, settingsName, settings));
                return(m_settingsDictionary.GetSettingsInstance(settingsName) == settings);
            }
            else
            {
                return(m_settingsDictionary.AddSettingsInstance(settingsName, settings));
            }
        }
        public HavokNavMeshGlobalSettings CreateGlobalSettings(string settingsName, bool bUndoable)
        {
            if (m_settingsDictionary == null)
            {
                // create a collection if doesn't exist
                m_settingsDictionary = new HavokNavMeshGlobalSettingsDictionary(this);
            }

            if (bUndoable)
            {
                EditorManager.Actions.Add(new CreateNavMeshGlobalSettingsAction(m_settingsDictionary, settingsName));
            }
            else
            {
                m_settingsDictionary.CreateAndAddSettingsInstance(settingsName);
            }
            HavokNavMeshGlobalSettings settings = m_settingsDictionary.GetSettingsInstance(settingsName);

            System.Diagnostics.Debug.Assert(settings == null || settings.Name == settingsName);
            return(settings);
        }
 public CreateNavMeshGlobalSettingsAction(HavokNavMeshGlobalSettingsDictionary collection, string settingsName)
 {
     m_collection   = collection;
     m_settingsName = settingsName;
 }
 public AddNavMeshGlobalSettingsAction(HavokNavMeshGlobalSettingsDictionary collection, string settingsName, HavokNavMeshGlobalSettings settings)
 {
     m_collection   = collection;
     m_settings     = settings;
     m_settingsName = settingsName;
 }