Exemplo n.º 1
0
    protected virtual void OnEnable()
    {
        m_AI = (vp_AI)target;

        if (m_AI != null)
        {
            if (m_AI.DefaultState == null)
            {
                m_AI.RefreshDefaultState();
            }
        }

        Plugins = m_AI.GetType().GetFields().Where(info => info.FieldType.BaseType == typeof(vp_AIPlugin)).OrderBy(info => ((vp_AIPlugin)info.GetValue(m_AI)).SortOrder).ToList();
    }
Exemplo n.º 2
0
    /// <summary>
    /// Handles the display of the States and Presets section
    /// </summary>
    protected static void StatesAndPresets()
    {
        GUILayout.Space(10);

        m_AI.StatesAndPresetsMainFoldout = EditorGUI.Foldout(new Rect(GUILayoutUtility.GetLastRect().xMin + 5, GUILayoutUtility.GetLastRect().yMin + 10, 400, 30), m_AI.StatesAndPresetsMainFoldout, " States And Presets", true, FoldoutStyle);
        GUILayout.Space(20);

        if (!m_AI.StatesAndPresetsMainFoldout)
        {
            DrawSeparator(2);
            return;
        }

        GUILayout.Space(10);

        EditorGUI.indentLevel++;

        // state
        m_AI.StateFoldout = vp_AIPresetEditorGUIUtility.StateFoldout(m_AI.StateFoldout, m_AI, m_AI.States);

        // preset
        m_AI.PresetFoldout = vp_AIPresetEditorGUIUtility.PresetFoldout(m_AI.PresetFoldout, m_AI);

        // update
        if (GUI.changed)
        {
            // update the default state in order not to loose inspector tweaks
            // due to state switches during runtime
            if (Application.isPlaying)
            {
                m_AI.RefreshDefaultState();
            }

            m_AI.Refresh();
        }

        EditorGUI.indentLevel--;

        GUILayout.Space(10);

        DrawSeparator();
    }