/// <summary>
    /// Setup rewired and add the input event delegates.
    /// </summary>
    /// <param name="rewiredPlayerID">Rewired player ID number.</param>
    public void InitRewired(int rewiredPlayerID)
    {
        _rewired = Rewired.ReInput.players.GetPlayer(rewiredPlayerID);

        if (_rewired == null)
        {
            Debug.Log("Rewired player " + rewiredPlayerID.ToString() + " is null!");
            return;
        }

        // register input event listeners
        _rewired.AddInputEventDelegate(
            setLeftEngineEmmision,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.Update,
            Constants.RewiredInputActions.LeftTrigger);

        _rewired.AddInputEventDelegate(
            setRightEngineEmmision,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.Update,
            Constants.RewiredInputActions.RightTrigger);
    }
    private void initRewired(int rewiredPlayerID)
    {
        _rewired = Rewired.ReInput.players.GetPlayer(rewiredPlayerID);

        // register input event listeners
        _rewired.AddInputEventDelegate(
            onLeftTriggerUpdate,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.Update,
            Constants.RewiredInputActions.LeftTrigger);

        _rewired.AddInputEventDelegate(
            onRightTriggerUpdate,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.Update,
            Constants.RewiredInputActions.RightTrigger);

        _rewired.AddInputEventDelegate(
            onRightTriggerUpdate,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.Update,
            Constants.RewiredInputActions.RightTrigger);

        _rewired.AddInputEventDelegate(
            onDeflatePressed,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.ButtonJustPressed,
            Constants.RewiredInputActions.Deflate);

        _rewired.AddInputEventDelegate(
            onDeflateReleased,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.ButtonJustReleased,
            Constants.RewiredInputActions.Deflate);

        _rewired.AddInputEventDelegate(
            onInflatePressed,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.ButtonJustPressed,
            Constants.RewiredInputActions.Inflate);

        _rewired.AddInputEventDelegate(
            onInflateReleased,
            Rewired.UpdateLoopType.Update,
            Rewired.InputActionEventType.ButtonJustReleased,
            Constants.RewiredInputActions.Inflate);
    }
Beispiel #3
0
 private void OnEnable()
 {
     Rewired.Player player = Rewired.ReInput.players.GetPlayer(0);
     player.AddInputEventDelegate(OnInputUpdate, Rewired.UpdateLoopType.Update);
 }