コード例 #1
0
	/// <summary>
	/// hooks up the component object as the inspector target
	/// </summary>
	public virtual void OnEnable()
	{

		m_Component = (vp_FPController)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();

	}
コード例 #2
0
    /// <summary>
    /// hooks up the component object as the inspector target
    /// </summary>
    public virtual void OnEnable()
    {
        m_Component = (vp_FPController)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();
        }
    }
コード例 #3
0
ファイル: vp_FPSDemoManager.cs プロジェクト: Fountai2/DSTM
 /// <summary>
 /// helper method to refresh all default states. for use
 /// after applying a preset to a vp_Component via script
 /// </summary>
 public void RefreshDefaultState()
 {
     if (Controller != null)
     {
         Controller.RefreshDefaultState();
     }
     if (Camera != null)
     {
         Camera.RefreshDefaultState();
         if (WeaponHandler.CurrentWeapon != null)
         {
             WeaponHandler.CurrentWeapon.RefreshDefaultState();
         }
         if (CurrentShooter != null)
         {
             CurrentShooter.RefreshDefaultState();
         }
     }
 }
コード例 #4
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        if (Application.isPlaying || m_Component.DefaultState.TextAsset == null)
        {
            DoMotorMoveFoldout();
            DoMotorJumpFoldout();
            DoPhysicsFoldout();
        }
        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();
            }
        }
    }
コード例 #5
0
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        GUI.color = Color.white;

        if (Application.isPlaying || m_Component.DefaultState.TextAsset == null)
        {
            DoMotorMoveFoldout();
            DoMotorJumpFoldout();
            DoPhysicsFoldout();
        }
        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();
            }
        }
    }