Exemple #1
0
        protected sealed override void Start()
        {
            base.Start();

            m_eventSystem = GetComponent <EventSystem>();

            for (int i = 0; i < InputManager.Length; i++)
            {
                Cursor cursor = Instantiate(m_cursorPrefab, m_cursorParent);
                cursor.SetID(i);
                if (i > 0)
                {
                    cursor.SetActive(false);
                }
                else
                {
                    cursor.SetActive(true);
                }

                m_cursorList.Add(cursor);
            }
        }
Exemple #2
0
        public override void Process()
        {
            for (int i = 0; i < m_cursorList.Count; i++)
            {
                Cursor cursor = m_cursorList[i];

                if (InputManager.GetDevice(i).Start.Press)
                {
                    cursor.SetActive(true);
                }

                if (!cursor.IsActive)
                {
                    return;
                }

                Vector2 cursorMovement = new Vector2(InputManager.GetDevice(i).LeftHorizontal.Value, InputManager.GetDevice(i).LeftVertical.Value);

                cursor.Move(InputManager.GetDevice(i).Action1.Press, cursorMovement);

                GetPointerData(i, out m_pointer, true);

                Vector3 screenPos = Camera.main.WorldToScreenPoint(cursor.transform.position);

                m_convertToScreenPos.x = screenPos.x;
                m_convertToScreenPos.y = screenPos.y;

                m_pointer.position = m_convertToScreenPos;

                m_eventSystem.RaycastAll(m_pointer, m_RaycastResultCache);
                RaycastResult raycastResult = FindFirstRaycast(m_RaycastResultCache);
                m_pointer.pointerCurrentRaycast = raycastResult;

                ProcessMove(m_pointer);

                m_pointer.clickCount = 0;

                SubmitHandler(InputManager.GetDevice(i).Action1.Press, raycastResult);
                DragHandler(InputManager.GetDevice(i).Action1.Hold, raycastResult);
            }
        }