Пример #1
0
        public override bool CheckSelected(Camera raycastCamera, Rect selectionRect, Transform rectSpaceTransform,
                                           ISelectionCoordinatesConverter coordsConverter)
        {
            foreach (var vertice in _vertices)
            {
                Vector3 worldSpaceVertice = transform.TransformPoint(vertice);
                Vector3 localSpaceVertice = coordsConverter.WorldSpaceVerticeToSelectionSpace(worldSpaceVertice);
                if (localSpaceVertice.x < selectionRect.xMin ||
                    localSpaceVertice.x > selectionRect.xMax ||
                    localSpaceVertice.y < selectionRect.yMin ||
                    localSpaceVertice.y > selectionRect.yMax)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        public override bool CheckSelected(Camera raycastCamera, Rect screenSelectionRect, Transform rectSpaceTransform,
                                           ISelectionCoordinatesConverter selectionCoordinatesConverter)
        {
            _vertices = _meshCollider.sharedMesh.vertices;
            foreach (var vertice in _vertices)
            {
                Vector3 worldSpaceVertice     = transform.TransformPoint(vertice);
                Vector2 selectionSpaceVertice = selectionCoordinatesConverter.WorldSpaceVerticeToSelectionSpace(worldSpaceVertice);
                if (selectionSpaceVertice.x < screenSelectionRect.xMin ||
                    selectionSpaceVertice.x > screenSelectionRect.xMax ||
                    selectionSpaceVertice.y < screenSelectionRect.yMin ||
                    selectionSpaceVertice.y > screenSelectionRect.yMax)
                {
                    return(false);
                }
            }

            return(true);
        }