Ejemplo n.º 1
0
    /// <summary>
    /// Update method performs actions each frame.
    /// </summary>
    void Update()
    {
        if (buildMinimap)
        {
            buildMinimap = false;
            yUp          = true;

            foreach (Transform child in mapObject.transform)
            {
                Transform miniChild = Instantiate(child, miniMapObject.transform);
                miniChild.gameObject.AddComponent <BoxCollider>();
            }
        }

        if (manipulationModeCountdown >= 1)
        {
            manipulationModeCountdown--;
            if (manipulationModeCountdown == 0)
            {
                enterManipulate();
            }
        }

        if (save)
        {
            save = false;

            ObjSaver.Save(SpatialMappingManager.Instance.GetMeshFilters(), saveStream);
            spatialMappingObject.SetActive(SpatialMappingActive);
            txt.text = "Spatial mapping saved to " + saveFileDisplayName;
        }

        if (load)
        {
            load = false;

            miniMapObject.transform.localScale = initialMiniMapScale;

            // empty map and mini map
            foreach (Transform child in mapObject.transform)
            {
                Destroy(child.gameObject);
            }
            foreach (Transform child in miniMapObject.transform)
            {
                Destroy(child.gameObject);
            }

            Material material = Resources.Load("defaultMat", typeof(Material)) as Material;

            ObjLoader.LoadOBJFile(loadFileDisplayName, material, loadStream, mapObject);

            buildMinimap = true;
            leaveManipulate();
            enterModelOverlay();
            rdd.enabled = false;
            txt.text    = "Mesh \"" + loadFileDisplayName + "\" loaded.";
        }
    }