コード例 #1
0
        private void OnEnable()
        {
            _virtualAxis = _virtualAxis ?? new VirtualAxis(AxisName);
            LastFingerId = -1;

            CnInputManager.RegisterVirtualAxis(_virtualAxis);
        }
コード例 #2
0
        private void OnEnable()
        {
            // When we enable, we get our virtual axis

            _horizintalAxis = _horizintalAxis ?? new VirtualAxis(HorizontalAxisName);
            _verticalAxis = _verticalAxis ?? new VirtualAxis(VerticalAxisName);

            // And register them in our input system
            CnInputManager.RegisterVirtualAxis(_horizintalAxis);
            CnInputManager.RegisterVirtualAxis(_verticalAxis);
        }
コード例 #3
0
 /// <summary>
 /// Unregisters the provided virtual axis
 /// </summary>
 /// <param name="virtualAxis">Virtual axis to unregister</param>
 public static void UnregisterVirtualAxis(VirtualAxis virtualAxis)
 {
     // If it's the first such virtual axis, create a new list for that axis name
     if (Instance._virtualAxisDictionary.ContainsKey(virtualAxis.Name))
     {
         if (!Instance._virtualAxisDictionary[virtualAxis.Name].Remove(virtualAxis))
         {
             Debug.LogError("Requested axis " + virtualAxis.Name + " exists, but there's no such virtual axis that you're trying to unregister");                    
         }
     }
     else
     {
         Debug.LogError("Trying to unregister an axis " + virtualAxis.Name + " that was never registered");
     }
 }
コード例 #4
0
        /// <summary>
        /// Registers the provided virtual axis
        /// </summary>
        /// <param name="virtualAxis">Virtual axis to register</param>
        public static void RegisterVirtualAxis(VirtualAxis virtualAxis)
        {
            // If it's the first such virtual axis, create a new list for that axis name
            if (!Instance._virtualAxisDictionary.ContainsKey(virtualAxis.Name))
            {
                Instance._virtualAxisDictionary[virtualAxis.Name] = new List<VirtualAxis>();
            }

            Instance._virtualAxisDictionary[virtualAxis.Name].Add(virtualAxis);
        }