Пример #1
0
    void DrawPlayerAvatarChoice(InputDevicePlayer inputDevicePlayer_)
    {
        float Size_Width = 200f;
        float Line_Size = 15f;
        Vector2 CurrentPosition = new Vector2(10f + (Size_Width * inputDevicePlayer_.InputId), 100f);
        Vector2 CurrentSize = new Vector2(Size_Width, Size_Width / 2);

        GUI.Label(new Rect(CurrentPosition, CurrentSize), "Escolha um Jogador");
        CurrentPosition.y += Line_Size;
        GUI.Label(new Rect(CurrentPosition, CurrentSize), CONSTANTS.PLAYER.CLASS_NAME[(int)inputDevicePlayer_.SelectingPlayerClassID]);
    }
Пример #2
0
    /// <summary>
    /// Associa um determinado controle ao Jogo
    /// </summary>
    void AttachInputDeviceToGame()
    {
        int freeInputDevicePosition;
        UnityInputDevice _currentDevice = null;

        for (int i = 0; i < InputManager.Devices.Count; i++)
        {
            _currentDevice = InputManager.Devices[i] as UnityInputDevice;

            if (_currentDevice != null && _currentDevice.IsKnown /* && _currentDevice.IsSupportedOnThisPlatform */ )
            {
                if (IsJoystickAssignedToPlayer(_currentDevice) == -1)
                {
                    if (IsJoystickAssignedToGame(_currentDevice) == -1)
                    {
                        freeInputDevicePosition = GetFreeInputDevicePosition();

                        if (freeInputDevicePosition > -1)
                        {
                            InputDevicePlayer _inputDevicePlayer = new InputDevicePlayer();
                            _inputDevicePlayer.InputId = _currentDevice.JoystickId;

                            if (ApplicationModel.Instance.State == GameState.InGame)
                                _inputDevicePlayer.IsSelectingClass_InGame = true;

                            _inputDevicePlayer.IsAssignedToPlayer = false;
                            _inputDevicePlayer.SelectingPlayerClassID = GetFreePlayerClassId(ENUMERATORS.Player.PlayerClass.MEDIC, true);
                            _inputDevicePlayer.myInputDevice = _currentDevice;
                            myInputDevicePlayers[freeInputDevicePosition] = _inputDevicePlayer;
                        }
                    }
                }
            }
        }
    }