コード例 #1
0
 private void Start()
 {
     _activeMappings = InputEx.IsControllerConnected() ? controllerMappings : kbMappings;
     if (_activeMappings.CreateControlBindings().TryGetValue(action, out var binding))
     {
         _binding = binding;
     }
     UpdateText();
 }
コード例 #2
0
 private void Update()
 {
     if (InputEx.IsControllerConnected())
     {
         mouse.SetActive(false);
         controller.SetActive(true);
     }
     else
     {
         mouse.SetActive(true);
         controller.SetActive(false);
     }
 }
コード例 #3
0
        private void Update()
        {
            bool updateNeeded = false;

            var mappings = InputEx.IsControllerConnected() ? controllerMappings : kbMappings;

            if (_activeMappings.CreateControlBindings().TryGetValue(action, out var binding))
            {
                updateNeeded = _binding.HasValue && !Equals(_binding.Value, binding);
                _binding     = binding;
            }

            if (mappings != _activeMappings)
            {
                _activeMappings = mappings;
                updateNeeded    = true;
            }

            if (updateNeeded)
            {
                UpdateText();
            }
        }