/// <summary>
	/// hooks up the component object as the inspector target
	/// </summary>
	public virtual void OnEnable()
	{

		m_Component = (vp_FPWeaponMeleeAttack)target;

		if (m_Persister == null)
			m_Persister = new vp_ComponentPersister();
		m_Persister.Component = m_Component;
		m_Persister.IsActive = true;

		if (m_Component.DefaultState == null)
			m_Component.RefreshDefaultState();

	}
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        m_Component.DrawDebugObjects = (m_SwingFoldout || m_ImpactFoldout || m_DamageFoldout);

        DoWeaponStatesFoldout();
        DoSwingFoldout();
        DoImpactFoldout();
        DoSoundFoldout();

        // state
        m_StateFoldout = vp_PresetEditorGUIUtility.StateFoldout(m_StateFoldout, m_Component, m_Component.States, m_Persister);

        GUILayout.BeginHorizontal();
        GUILayout.Space(10);
        m_Component.AttackPickRandomState = GUILayout.Toggle(m_Component.AttackPickRandomState, "Pick a random state for each attack");
        GUILayout.Space(10);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.HelpBox("Uncheck to use Default state only (or in case you want to enable specific states via script).", MessageType.Info);
        GUILayout.Space(10);
        GUILayout.EndHorizontal();

        // preset
        m_PresetFoldout = vp_PresetEditorGUIUtility.PresetFoldout(m_PresetFoldout, m_Component);

        // update default state and persist in order not to loose inspector tweaks
        // due to state switches during runtime - UNLESS a runtime state button has
        // been pressed (in which case user wants to toggle states as opposed to
        // reset / alter them)
        if (GUI.changed &&
            (!vp_PresetEditorGUIUtility.RunTimeStateButtonTarget == m_Component))
        {
            EditorUtility.SetDirty(target);

            if (Application.isPlaying)
            {
                m_Component.RefreshDefaultState();
            }

            if (m_Component.Persist)
            {
                m_Persister.Persist();
            }
        }
    }
    /// <summary>
    /// hooks up the component object as the inspector target
    /// </summary>
    public virtual void OnEnable()
    {
        m_Component = (vp_FPWeaponMeleeAttack)target;

        if (m_Persister == null)
        {
            m_Persister = new vp_ComponentPersister();
        }
        m_Persister.Component = m_Component;
        m_Persister.IsActive  = true;

        if (m_Component.DefaultState == null)
        {
            m_Component.RefreshDefaultState();
        }
    }
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        m_Component.DrawDebugObjects = (m_SwingFoldout || m_ImpactFoldout || m_DamageFoldout);

        //if (!Application.isPlaying)
        //{

        DoWeaponStatesFoldout();
        DoSwingFoldout();
        DoImpactFoldout();
        DoDamageFoldout();
        DoFXFoldout();
        DoSoundFoldout();

        //}
        //else
        //{

        //GUI.enabled = false;
        //GUILayout.Label("\nThis component can not be modified at runtime.\n", vp_EditorGUIUtility.NoteStyle);
        //GUI.enabled = true;

        //}

        // state
        m_StateFoldout = vp_PresetEditorGUIUtility.StateFoldout(m_StateFoldout, m_Component, m_Component.States, m_Persister);

        GUILayout.BeginHorizontal();
        GUILayout.Space(10);
        m_Component.AttackPickRandomState = GUILayout.Toggle(m_Component.AttackPickRandomState, "Pick a random state for each attack");
        GUILayout.Space(10);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.HelpBox("Uncheck to use Default state only (or in case you want to enable specific states via script).", MessageType.Info);
        GUILayout.Space(10);
        GUILayout.EndHorizontal();

        // preset
        m_PresetFoldout = vp_PresetEditorGUIUtility.PresetFoldout(m_PresetFoldout, m_Component);

        // update
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);

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

            if (m_Component.Persist)
            {
                m_Persister.Persist();
            }
        }
    }