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

		m_Component = (vp_FPWeaponShooter)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>
    /// hooks up the object to the inspector target
    /// </summary>
    public virtual void OnEnable()
    {
        m_Component = (vp_FPWeaponShooter)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();
        }
    }
Exemple #3
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        if (Application.isPlaying || m_Component.DefaultState.TextAsset == null)
        {
            DoProjectileFoldout();
            DoMotionFoldout();
            DoMuzzleFlashFoldout();
            DoShellFoldout();
            DoSoundFoldout();
            DoAnimationFoldout();
        }
        else
        {
            vp_PresetEditorGUIUtility.DefaultStateOverrideMessage();
        }

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

        // 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();
            }

            m_Component.Refresh();
        }
    }
Exemple #4
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        string objectInfo = m_Component.gameObject.name;

        if (vp_Utility.IsActive(m_Component.gameObject))
        {
            GUI.enabled = true;
        }
        else
        {
            GUI.enabled = false;
            objectInfo += " (INACTIVE)";
        }

        if (!vp_Utility.IsActive(m_Component.gameObject))
        {
            GUI.enabled = true;
            return;
        }

        if (Application.isPlaying || m_Component.DefaultState.TextAsset == null)
        {
            DoProjectileFoldout();
            DoMotionFoldout();
            DoMuzzleFlashFoldout();
            DoShellFoldout();
            DoSoundFoldout();
            DoAnimationFoldout();
        }
        else
        {
            vp_PresetEditorGUIUtility.DefaultStateOverrideMessage();
        }

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

        // 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();
            }

            m_Component.Refresh();
        }
    }