Exemple #1
0
    private void Start()
    {
        mapSession = new MapSession(mapWorker, MapMetaManager.LoadAll());
        mapSession.LoadMapMeta(mapTemp, true);

        mapSession.CurrentMapLocalized = (mapData) =>
        {
            this.mapData = mapData;
        };
        videoCamera.DeviceOpened += () =>
        {
            if (videoCamera == null)
            {
                return;
            }
            videoCamera.FocusMode = CameraDeviceFocusMode.Continousauto;
        };


#if UNITY_EDITOR
        dataDropdown.gameObject.SetActive(true);
        InitPointData();
#endif
        PropDragger.SetMapSession(mapSession);
    }
Exemple #2
0
    public void DebugObj(int index)
    {
        mapData = mapSession?.Maps[index];
        UpdatePointCloud(GetCurrentPointData);

        controller = GameObject.Find("ObjParents");
        if (controller == null)
        {
            controller = new GameObject("ObjParents");
        }

        for (int i = 0; i < controller.transform.childCount; i++)
        {
            Destroy(controller.transform.GetChild(i).gameObject);
        }


        foreach (var propInfo in mapData?.Meta.Props)
        {
            GameObject prop = null;
            foreach (var templet in PropCollection.Instance.Templets)
            {
                if (templet.Object.name == propInfo.Name)
                {
                    prop = UnityEngine.Object.Instantiate(templet.Object);
                    break;
                }
            }
            if (!prop)
            {
                Debug.LogError("Missing prop templet: " + propInfo.Name);
                continue;
            }
            prop.transform.parent        = controller.transform;
            prop.transform.localPosition = new UnityEngine.Vector3(propInfo.Position[0], propInfo.Position[1], propInfo.Position[2]);
            prop.transform.localRotation = new Quaternion(propInfo.Rotation[0], propInfo.Rotation[1], propInfo.Rotation[2], propInfo.Rotation[3]);
            prop.transform.localScale    = new UnityEngine.Vector3(propInfo.Scale[0], propInfo.Scale[1], propInfo.Scale[2]);
            prop.name = propInfo.Name;
            mapData?.Props.Add(prop);
        }
    }