Esempio n. 1
0
    private Vector2 CenterSquare(BorderSquare square)
    {
        var x = square.xMin + (square.xMax - square.xMin) / 2.0f;
        var y = square.yMin + (square.yMax - square.yMin) / 2.0f;

        return(new Vector2(x, y));
    }
Esempio n. 2
0
    private void PaintBigSquare(List <Group> list)
    {
        Color[] colors = new Color[] {
            new Color(255, 0, 0),
            new Color(0, 255, 0),
            new Color(0, 0, 255),
            new Color(255, 255, 0),
            new Color(255, 0, 255),
            new Color(0, 255, 255),
            new Color(255, 255, 255)
        };


        int   maxCount = 0;
        Group group    = null;

        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].GetCount() > maxCount)
            {
                maxCount = list[i].GetCount();
                group    = list[i];
            }
        }
        if (group == null)
        {
            return;
        }
        mainSquare = group.GetGranica(size);
        PaintSquare(mainSquare.xMin, mainSquare.xMax, mainSquare.yMin, mainSquare.yMax, colors[1]);
    }
Esempio n. 3
0
    private void Move()
    {
        BorderSquare mainSquare = porcessing?.GetMainSquare();

        if (mainSquare != null)
        {
            var positionInPixels     = CenterSquare(mainSquare);
            var positionInScreen     = convertPixScreen.CameraToScreen(positionInPixels);
            var positionInScreenAndZ = new Vector3(positionInScreen.x, positionInScreen.y, 4.14f);
            var positionGO           = Camera.main.ScreenToWorldPoint(positionInScreenAndZ);
            positionGO = new Vector3(positionGO.x, positionGO.y, 0);
            gameObjectAR.transform.position = positionGO;
        }
    }