Exemplo n.º 1
0
    private void Awake()
    {
        player = ReInput.players.GetPlayer(playerID);

        for (int i = 0; i < ReInput.mapping.Actions.Count; i++)
        {
            player.AddInputEventDelegate(OnButtonDown, UpdateLoopType.Update, InputActionEventType.ButtonLongPressed, ReInput.mapping.Actions[i].name);
            player.AddInputEventDelegate(OnButton, UpdateLoopType.Update, InputActionEventType.Update, ReInput.mapping.Actions[i].name);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Validate that any serialized fields are properly set.
    /// A Valid Manager should function properly.
    /// </summary>
    /// <returns></returns>
    //protected override bool ValidateManager()
    //{
    //    bool isValid = true;

    //    isValid = isValid && (m_RewiredPlayer != null);
    //    isValid = isValid && base.ValidateManager();

    //    return isValid;
    //}

    ///////////////////////////////////////////////////////////////////
    /// InputManager Implementation
    ///////////////////////////////////////////////////////////////////


    /// <summary>
    /// Add an input event delegate to the player. Use Rewired to handle this.. so great!
    /// </summary>
    /// <param name="inputDelegate"></param>
    /// <param name="updateType"></param>
    public void AddInputEventDelegate(Action <InputActionEventData> inputDelegate, UpdateLoopType updateType)
    {
        Debug.Assert(m_RewiredPlayer != null, "Rewired Player is null, cannot add input delegate!");

        if (m_RewiredPlayer != null)
        {
            m_RewiredPlayer.AddInputEventDelegate(inputDelegate, updateType);

            m_InputDelegateCache.Add(inputDelegate);
        }
    }