コード例 #1
0
        private NativeArray <float2> GetMouseTouch(InputSystem input)
        {
            if (input.GetMouseButton(0))
            {
                var mousePosition = CameraUtil.ScreenPointToViewportPoint(EntityManager, input.GetInputPosition());

                var touches = new NativeArray <float2>(1, Allocator.TempJob);
                touches[0] = mousePosition;
                return(touches);
            }

            return(new NativeArray <float2>(0, Allocator.TempJob));
        }
コード例 #2
0
        private NativeArray <float2> GetTouches(InputSystem input)
        {
            var touchCount = input.TouchCount();

            if (touchCount > 0)
            {
                var touches = new NativeArray <float2>(touchCount, Allocator.TempJob);
                for (var i = 0; i < touchCount; i++)
                {
                    touches[i] = CameraUtil.ScreenPointToViewportPoint(EntityManager, new float2(input.GetTouch(i).x, input.GetTouch(i).y));
                }

                return(touches);
            }

            return(new NativeArray <float2>(0, Allocator.TempJob));
        }