Example #1
0
 static DirectInputStartupEditor()
 {
     UnityEditor.EditorApplication.quitting += OnQuitting;
     Debug.Log(FFB.GetActiveWindow());
     FFB.ForceFeedBackInit();    // is the window already running?
     Debug.Log("ForceFeedBack UP and Running");
 }
Example #2
0
 private void ReleaseDirectInput(PlayModeStateChange state)
 {
     if (state == PlayModeStateChange.ExitingPlayMode)
     {
         FFB.FreeDirectInput();      //Currently buggy, crashs edtior
     }
 }
Example #3
0
 private void StopDirectInput(PlayModeStateChange state)
 {
     if (state == PlayModeStateChange.ExitingPlayMode)
     {
         FFB.StopForceFeedback();      //Currently buggy, crashs edtior
     }
 }
Example #4
0
    //Carcontroller.GetSteering (-1, 0 ,1 ) * 540 //Target
    //Input *540 //Input Angle

    // IF -1 Right Direction
    // IF 1 Left Direction

    /*IEnumerator GoToPosition()
     * {
     *  while (1)
     *  {
     *      _carController.GetSterring()
     *  }
     * }*/


    #if !UNITY_EDITOR
    private void OnDestroy()
    {
        if (!FFB.needInit)
        {
            FFB.FreeDirectInput();
        }
        else
        {
            FFB.needInit = false;
            return;
        }
    }
Example #5
0
 private void OnTriggerExit(Collider other)
 {
     if (mFFB == null)
     {
         return;
     }
     print("止める");
     mFFB.Vibration(0, 0f);
     mFFB = null;
     if (mSource.clip != null)
     {
         mSource.Stop();
     }
 }
Example #6
0
 private void OnTriggerEnter(Collider other)
 {
     mFFB = other.GetComponent <FFB>();
     if (mFFB == null)
     {
         return;
     }
     print("動かす");
     mFFB.Vibration(mPower, mTime);
     if (mSource.clip != null)
     {
         mSource.Play();
     }
 }
Example #7
0
    void Start()
    {
        _carController    = GetComponent <CarController>();
        _manualController = GetComponent <ManualController>();
        _controlSwitch    = GetComponent <ControlSwitch>();

        if (shouldInit && FFB.needInit)
        {
            FFB.ForceFeedBackInit();
            #if !UNITY_EDITOR
            FFB.AcquireDevice();
            #endif
        }
        #if UNITY_EDITOR
        FFB.AcquireDevice();
        #endif
    }
Example #8
0
 private static void OnQuitting()
 {
     Debug.Log("Releasing Direct Input!");
     FFB.Release();
 }
Example #9
0
    public void SetManualForceFeedbackEffect(float force)
    {
        int rounded = (int)force;

        FFB.SetDeviceForceFeedback(rounded, 0);
    }
Example #10
0
    public void SetAutoPilotForceFeedbackEffect(float force)
    {
        int rounded = (int)-force;

        FFB.SetDeviceForceFeedback(rounded, 0);
    }