//checks if it is within bounds
    public bool IsWithinSelectionBounds(GameObject gameObject)
    {
        if (!dragSelecting)
        {
            return(false);
        }

        var viewportBounds = SelectionBox.GetViewportBounds(cam, playerMouse, Input.mousePosition);

        return(viewportBounds.Contains(cam.WorldToViewportPoint(gameObject.transform.position)));
    }
Пример #2
0
    public bool IsWithinSelectionBounds(GameObject gameObject)  //Checks to see if game object passed in is within the selection bounds
    {
        if (!isSelecting)
        {
            return(false);
        }

        var camera         = Camera.main;
        var viewportBounds =
            SelectionBox.GetViewportBounds(camera, mousePosition1, Input.mousePosition);

        return(viewportBounds.Contains(
                   camera.WorldToViewportPoint(gameObject.transform.position)));
    }