void Start()
    {
        int numMice = ManyMouseWrapper.MouseCount;

        if (numMice > 0)
        {
            _manyMouseMice = new ManyMouse[numMice];
            for (int i = 0; i < numMice; i++)
            {
                _manyMouseMice[i] = ManyMouseWrapper.GetMouseByID(i);
                _manyMouseMice[i].EventButtonDown += EventButtonDownJoinGame;
                //you'll want to pay attention to things disconnecting.
                _manyMouseMice[i].EventMouseDisconnected += EventMouseDisconnected;
            }
        }
    }
    private ManyMouse _mouse; //This is what you'll grab input from.

    public void Init(int mouseID)
    {
        _mouseId = mouseID;
        if (ManyMouseWrapper.MouseCount > _mouseId)
        {
            _mouse = ManyMouseWrapper.GetMouseByID(_mouseId);
            Debug.Log(gameObject.name + " connected to mouse: " + _mouse.DeviceName);

            //List to mouse button events
            _mouse.EventButtonDown += EventButtonDown;
        }
        else
        {
            Debug.Log("Mouse ID " + _mouseId + " not found. Plug in an extra mouse?");
            Destroy(gameObject);
        }
    }
Exemplo n.º 3
0
    void SetUpCursor()
    {
        int mouseNumber;

        if (ManyMouseWrapper.MouseCount < 2)
        {
            if (player == Player.PlayerA)
            {
                mouseNumber            = 0;
                mouse                  = ManyMouseWrapper.GetMouseByID(mouseNumber);
                mouse.EventButtonDown  = delegate { };
                mouse.EventButtonUp    = delegate { };
                mouse.EventButtonDown += CloseHand;
                mouse.EventButtonUp   += OpenHand;
            }
            else
            {
                disabled = true;
            }
        }
        else
        {
            if (player == Player.PlayerA)
            {
                mouseNumber = PlayerPrefs.GetInt("MouseIdA", 0);
            }
            else
            {
                mouseNumber = PlayerPrefs.GetInt("MouseIdB", 1);
            }

            mouse = ManyMouseWrapper.GetMouseByID(mouseNumber);
            mouse.EventButtonDown  = delegate { };
            mouse.EventButtonUp    = delegate { };
            mouse.EventButtonDown += CloseHand;
            mouse.EventButtonUp   += OpenHand;
        }
    }