Пример #1
0
        protected void AddPointer(Pointer pointer)
        {
            if (pointer == null)
            {
                throw new ArgumentNullException(nameof(pointer));
            }

            // Ignore if already added.
            if (ArrayHelpers.ContainsReference(m_Sources, m_NumSources, pointer))
            {
                return;
            }

            var numPositions = m_NumSources;

            ArrayHelpers.AppendWithCapacity(ref m_CurrentPositions, ref numPositions, Vector2.zero);
            var index = ArrayHelpers.AppendWithCapacity(ref m_Sources, ref m_NumSources, pointer);

            InstallStateChangeMonitors(index);
        }
Пример #2
0
        protected void AddPointer(Pointer pointer)
        {
            if (pointer == null)
            {
                throw new ArgumentNullException(nameof(pointer));
            }

            // Ignore if already added.
            if (ArrayHelpers.ContainsReference(m_Pointers, m_NumPointers, pointer))
            {
                return;
            }

            // Add to list.
            var numPointers = m_NumPointers;

            ArrayHelpers.AppendWithCapacity(ref m_Pointers, ref m_NumPointers, pointer);
            ArrayHelpers.AppendWithCapacity(ref m_CurrentPositions, ref numPointers, default);

            InputSystem.DisableDevice(pointer, keepSendingEvents: true);
        }