예제 #1
0
	/// <summary>
	/// hooks up the FPSCamera object to the inspector target
	/// </summary>
	public void OnEnable()
	{

		m_Component = (vp_FPInput)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 FPSCamera object to the inspector target
    /// </summary>
    public void OnEnable()
    {
        m_Component = (vp_FPInput)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
    /// <summary>
    ///
    /// </summary>
    public override void OnInspectorGUI()
    {
        if (Application.isPlaying || m_Component.DefaultState.TextAsset == null)
        {
            DoMouseLookFoldout();
            DoMouseCursorFoldout();
        }
        else
        {
            vp_PresetEditorGUIUtility.DefaultStateOverrideMessage();
        }

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

        // preset foldout
        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();
        }
    }
예제 #4
0
 /// <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();
         }
     }
     if (Input != null)
     {
         Input.RefreshDefaultState();
     }
 }