Пример #1
0
        /// <summary>
        /// Registers the provided virtual button
        /// </summary>
        /// <param name="virtualButton">Virtual button to register</param>
        public static void RegisterVirtualButton(VirtualButton virtualButton)
        {
            if (!Instance._virtualButtonsDictionary.ContainsKey(virtualButton.Name))
            {
                Instance._virtualButtonsDictionary[virtualButton.Name] = new List<VirtualButton>();
            }

            Instance._virtualButtonsDictionary[virtualButton.Name].Add(virtualButton);
        }
Пример #2
0
 /// <summary>
 /// Unregisters the provided virtual button
 /// </summary>
 /// <param name="virtualButton">Virtual button to unregister</param>
 public static void UnregisterVirtualButton(VirtualButton virtualButton)
 {
     if (Instance._virtualButtonsDictionary.ContainsKey(virtualButton.Name))
     {
         if (!Instance._virtualButtonsDictionary[virtualButton.Name].Remove(virtualButton))
         {
             Debug.LogError("Requested button axis exists, but there's no such virtual button that you're trying to unregister");
         }
     }
     else
     {
         Debug.LogError("Trying to unregister a button that was never registered");
     }
 }
Пример #3
0
 /// <summary>
 /// It's pretty simple here
 /// When we enable, we register our button in the input system
 /// </summary>
 private void OnEnable()
 {
     _virtualButton = _virtualButton ?? new VirtualButton(ButtonName);
     XInput.RegisterVirtualButton(_virtualButton);
 }