Exemplo n.º 1
0
    void InitInputConfigurations()
    {
        int playerNumber = InputMng.GetJoystickNames().Length;

        if (playerNumber > 4)
        {
            playerNumber = 4;
        }

        string confNamePrefix = "Win";

        if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor)
        {
            confNamePrefix = "OS_X";
        }

        for (int i = 0; i < playerNumber; i++)
        {
            TeamUtility.IO.PlayerID playerId = (TeamUtility.IO.PlayerID)System.Enum.GetValues(typeof(TeamUtility.IO.PlayerID)).GetValue(i);
            InputMng.SetInputConfiguration(confNamePrefix + "_gamepad_" + (i + 1), playerId);
        }

        if (playerNumber < 4)
        {
            TeamUtility.IO.PlayerID playerId = (TeamUtility.IO.PlayerID)System.Enum.GetValues(typeof(TeamUtility.IO.PlayerID)).GetValue(playerNumber);
            InputMng.SetInputConfiguration("keyboard", playerId);
            playersConnected = playerNumber + 1;
        }
        else
        {
            playersConnected = 4;
        }
    }
Exemplo n.º 2
0
        private void SetInputDevice(InputDevice inpuDevice)
        {
            _inputDevice = inpuDevice;
            if (inpuDevice == InputDevice.Joystick)
            {
#if UNITY_5
                Cursor.visible = false;
#else
                Screen.showCursor = false;
#endif
                InputManager.SetInputConfiguration(_joystickConfiguration, PlayerID.One);
                Debug.Log("Current Input Device: Joystick");
            }
            else
            {
#if UNITY_5
                Cursor.visible = true;
#else
                Screen.showCursor = true;
#endif
                InputManager.SetInputConfiguration(_keyboardConfiguration, PlayerID.One);
                Debug.Log("Current Input Device: KeyboardAndMouse");
            }
            ResetInputAxes();
            RaiseInputDeviceChangedEvent();
        }
Exemplo n.º 3
0
        private void SetInputDevice(InputDevice inpuDevice)
        {
            _inputDevice = inpuDevice;
            if (inpuDevice == InputDevice.Joystick)
            {
                Cursor.visible = false;
                InputManager.SetInputConfiguration(_joystickConfiguration);
#if UNITY_EDITOR
                //Debug.Log("Current Input Device: Joystick");
#endif
            }
            else
            {
                Cursor.visible = true;
                InputManager.SetInputConfiguration(_keyboardConfiguration);
#if UNITY_EDITOR
                //Debug.Log("Current Input Device: KeyboardAndMouse");
#endif
            }
            InputManager.ResetInputAxes();
            RaiseInputDeviceChangedEvent();
        }