Esempio n. 1
0
    private void Update()
    {
        InputSystem.onDeviceChange += (device, change) =>
        {
            switch (change)
            {
            case InputDeviceChange.Added:
                if (!ManetteContains((Gamepad)device))
                {
                    PlayerInputs.gamepads.Add(new Manette((Gamepad)device));
                    Debug.Log("ADDED DEVICE " + device.displayName);
                }
                break;

            case InputDeviceChange.Removed:
                RemoveManette((Gamepad)device);
                break;
            }
        };
        //Debug.Log("WE HAVE " + PlayerInputs.gamepads.Count + " GAMEPADS!");
        foreach (Manette man in PlayerInputs.gamepads)
        {
            if (man.joinButton.IsPressed() && (!PlayerInputs.pControllers.Contains(man)))
            {
                PlayerInputs.AddPlayerController(man);
            }
        }
    }