示例#1
0
    void Start()
    {
        spatialGraph = qrCodePlane.GetComponent <SpatialGraphCoordinateSystem>();
        plane        = qrCodePlane.transform.Find("Cube").gameObject;
        data         = qrCodePlane.transform.Find("Text").GetComponent <TextMeshPro>();

        qRScanner = GetComponent <QRScanner>();
        qRScanner.OnScanned
        .Subscribe(qr =>
        {
            qrCodePlane.SetActive(true);
            spatialGraph.Id = qr.SpatialGraphNodeId;
            plane.transform.localPosition = new Vector3(qr.PhysicalSideLength / 2, qr.PhysicalSideLength / 2, 0);
            plane.transform.localScale    = new Vector3(qr.PhysicalSideLength, qr.PhysicalSideLength, 0.001f);
            data.text = qr.Data;
            data.gameObject.transform.localPosition = new Vector3(qr.PhysicalSideLength / 2, qr.PhysicalSideLength / 2, -0.001f);
        })
        .AddTo(this);
        qRScanner.IsReady
        .Where(x => x)
        .First()
        .Subscribe(_ => qRScanner.StartScan())
        .AddTo(this);

        qrCodePlane.SetActive(false);
    }
示例#2
0
 private void Update()
 {
     if (updatedId)
     {
         if (coordSystem == null)
         {
             coordSystem = gameObjectToAttach.GetComponent <SpatialGraphCoordinateSystem>();
             if (coordSystem == null)
             {
                 coordSystem = gameObjectToAttach.AddComponent <SpatialGraphCoordinateSystem>();
             }
         }
         coordSystem.Id = qrCodeId;
         updatedId      = false;
     }
 }