public HavokNavMeshGlobalSettings CreateAndAddSettingsInstance(string settingsName)
        {
            HavokNavMeshGlobalSettings tempSettings = null;
              if (m_settingsDictionary.TryGetValue(settingsName, out tempSettings))
              {
            // settings object already exists!
            // return null to signal failure to create new one
            return null;
              }

              // sanity check name
              if (settingsName != null && settingsName.Length > 0)
              {
            HavokNavMeshGlobalSettings newSettings = new HavokNavMeshGlobalSettings(this, settingsName);
            m_settingsDictionary.Add(settingsName, newSettings);

            // if this is the first and only settings instance, update the default settings to refer to this
            if (m_settingsDictionary.Count == 1)
            {
              m_defaultSettingsName = settingsName;
            }
            return newSettings;
              }

              return null;
        }
Пример #2
0
        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 bool AddSettingsInstance(string newSettingsName, HavokNavMeshGlobalSettings newSettings)
        {
            if (newSettingsName == null || newSettingsName.Length == 0)
              {
            return false;
              }

              HavokNavMeshGlobalSettings existingSettings;
              if (!m_settingsDictionary.TryGetValue(newSettingsName, out existingSettings))
              {
            newSettings.Parent = this;
            m_settingsDictionary.Add(newSettingsName, newSettings);
            // if this is the first and only settings instance, update the default settings to refer to this
            if (m_settingsDictionary.Count == 1)
            {
              m_defaultSettingsName = newSettingsName;
            }
            return true;
              }
              return false;
        }
 public NavMeshSettingsUndoRedoPropertyDescriptor(PropertyDescriptor srcDescripter, PropertyFlags_e propFlags, HavokNavMeshGlobalSettings settings)
     : base(srcDescripter, propFlags, null, settings)
 {
 }
 public AddNavMeshGlobalSettingsAction(HavokNavMeshGlobalSettingsDictionary collection, string settingsName, HavokNavMeshGlobalSettings settings)
 {
     m_collection = collection;
       m_settings = settings;
       m_settingsName = settingsName;
 }
        public override void Do()
        {
            // save old settings
              m_settings = m_collection.GetSettingsInstance(m_settingsName);
              System.Diagnostics.Debug.Assert(m_settings != null);
              m_collection.DeleteSettingsInstance(m_settingsName);

              ShapeCollection navMeshShapes = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshShape));
              foreach (HavokNavMeshShape navMeshShape in navMeshShapes)
              {
            if (navMeshShape.NavMeshGlobalSettingsKey == m_settingsName)
            {
              IScene.SendShapeChangedEvent(new CSharpFramework.Shapes.ShapeChangedArgs(navMeshShape, CSharpFramework.Shapes.ShapeChangedArgs.Action.RefreshProperties));
            }
              }
        }
 public DeleteNavMeshGlobalSettingsAction(HavokNavMeshGlobalSettingsDictionary collection, string settingsName)
 {
     m_collection = collection;
       m_settings = null;
       m_settingsName = settingsName;
 }