Ejemplo n.º 1
0
 private void ActivateDevice()
 {
     InputUser.PerformPairingWithDevice(this.device, user);
     //gameplayInput.Enable();
     user.AssociateActionsWithUser(gameplayInput);
     user.AssociateActionsWithUser(uiInput);
     user.ActivateControlScheme(this.schemeName);
 }
Ejemplo n.º 2
0
    ////TODO: this is also where we should look for whether we have custom bindings for the user that we should activate
    public bool OnJoin(InputUser user)
    {
        Debug.Assert(user.valid);
        Debug.Assert(user.pairedDevices.Count == 1, "Players should join on exactly one input device");

        // Associate our InputUser with the actions we're using.
        user.AssociateActionsWithUser(controls);

        // Find out what control scheme to use and whether we have all the devices needed for it.
        var controlScheme = SelectControlSchemeBasedOnDevice(user.pairedDevices[0]);

        Debug.Assert(controlScheme.HasValue, "Must not join player on devices that we have no control scheme for");

        // Try to activate control scheme. The scheme may require additional devices which we
        // also need to pair to the user. This process may fail and we may end up a player missing
        // devices to start playing.
        user.ActivateControlScheme(controlScheme.Value).AndPairRemainingDevices();
        if (user.hasMissingRequiredDevices)
        {
            return(false);
        }

        // Put the player in joined state.
        m_User = user;
        ChangeState(State.Joined);

        return(true);
    }
Ejemplo n.º 3
0
 public void SwitchControlScheme(InputControlScheme controlScheme)
 {
     User.UnpairDevices();
     User.ActivateControlScheme(controlScheme).AndPairRemainingDevices();
 }