Example #1
0
        public void UpdateMovement(InputManager.ControllerType controller,
                                   Vector3 input, bool shoot)
        {
            PlayerUnit playerUnit = null;

            foreach (var player in _players)
            {
                if (player.Value.Data.Controller == controller)
                {
                    playerUnit = player.Value;
                }
            }

            if (playerUnit != null)
            {
                playerUnit.HandleInput(input, shoot);
            }
        }
Example #2
0
    // Use this for initialization
    void Start()
    {
        car              = GameObject.FindGameObjectWithTag("Player");
        time             = car.GetComponent <CheckpointScript>().time;
        inputType        = car.GetComponent <InputManager>().inputType;
        currentTime.text = "Your time: " + car.GetComponent <CheckpointScript>().timeOnScreen.text;


        selectedIndex     = 0;
        selectedCharacter = characters[selectedIndex];
        selected.text     = "Character: " + characters[selectedIndex];

        if (inputType == InputManager.ControllerType.ps4Controller)
        {
            verticalAxisName = "Ps4Vertical";
            submitName       = "Ps4Submit";
            backName         = "Ps4Back";
            pauseName        = "Ps4Pause";
        }
        else if (inputType == InputManager.ControllerType.xboxController)
        {
            verticalAxisName = "XboxVertical";
            submitName       = "XboxSubmit";
            backName         = "XboxBack";
            pauseName        = "XboxPause";
        }
        else if (inputType == InputManager.ControllerType.steeringWheel)
        {
            verticalAxisName = "SteeringwheelVertical";
            submitName       = "SteeringwheelSubmit";
            backName         = "SteeringwheelBack";
            pauseName        = "SteeringwheelPause";
        }
        else if (inputType == InputManager.ControllerType.keyboard)
        {
            verticalAxisName = "KeyboardVertical";
            submitName       = "KeyboardSubmit";
            backName         = "KeyboardBack";
            pauseName        = "KeyboardPause";
        }
    }
Example #3
0
    public void UpdatePauseButton()
    {
        inputType = car.GetComponent <InputManager>().inputType;

        if (inputType == InputManager.ControllerType.keyboard)
        {
            pauseButtonName = "KeyboardPause";
        }
        else if (inputType == InputManager.ControllerType.ps4Controller)
        {
            pauseButtonName = "Ps4Pause";
        }
        else if (inputType == InputManager.ControllerType.steeringWheel)
        {
            pauseButtonName = "SteeringwheelPause";
        }
        else if (inputType == InputManager.ControllerType.xboxController)
        {
            pauseButtonName = "XboxPause";
        }
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        car       = GameObject.FindGameObjectWithTag("Player");
        inputType = car.GetComponent <InputManager>().inputType;

        if (inputType == InputManager.ControllerType.keyboard)
        {
            pauseButtonName = "KeyboardPause";
        }
        else if (inputType == InputManager.ControllerType.ps4Controller)
        {
            pauseButtonName = "Ps4Pause";
        }
        else if (inputType == InputManager.ControllerType.steeringWheel)
        {
            pauseButtonName = "SteeringwheelPause";
        }
        else if (inputType == InputManager.ControllerType.xboxController)
        {
            pauseButtonName = "XboxPause";
        }
    }
        public void Init(PlayerData.PlayerId id,
                         InputManager.ControllerType defaultControllerType)
        {
            _dropdown = GetComponentInChildren <Dropdown>(true);
            _dropdown.ClearOptions();
            List <Dropdown.OptionData> optionDataList =
                new List <Dropdown.OptionData>();

            foreach (var value in
                     Enum.GetValues(typeof(InputManager.ControllerType)))
            {
                if ((InputManager.ControllerType)value !=
                    InputManager.ControllerType.None)
                {
                    string controllerName =
                        InputManager.GetControllerName(
                            (InputManager.ControllerType)value);
                    optionDataList.Add(new Dropdown.OptionData(controllerName));
                }
            }

            _dropdown.AddOptions(optionDataList);
            _dropdown.onValueChanged.AddListener(OnValueChanged);

            Id         = id;
            Controller = defaultControllerType;

            int defaultIndex =
                GetItemIndex(InputManager.
                             GetControllerName(defaultControllerType));

            if (defaultIndex > 0)
            {
                _dropdown.value = defaultIndex;
            }
        }
 public void UpdateMovement(InputManager.ControllerType controller,
                            Vector3 input, bool shoot)
 {
     PlayerUnits.UpdateMovement(controller, input, shoot);
 }
 private void OnValueChanged(int index)
 {
     Controller = InputManager.GetControllerTypeByName(
         _dropdown.options[index].text);
 }