Ejemplo n.º 1
0
    /// <summary>
    /// Called after asset is imported to the scene
    /// </summary>
    /// <param name="asset">The asset imported to the scene</param>
    /// <param name="result">result of the import request => gameobject / error</param>
    private static void ImportAssetCallback(PolyAsset asset, PolyStatusOr <PolyImportResult> result)
    {
        if (!result.Ok)
        {
            Toaster.showToast("Failed to import asset. Reason: " + result.Status, 2);
            return;
        }
        GameObject importedAsset = result.Value.gameObject;

        AssetPlacer.setupAsset(importedAsset);
        Instance.loadingPanel.SetActive(false);
    }
Ejemplo n.º 2
0
    public List <ARAsset> loadedAssets;                                  // store all the assets loaded in AR scene
    #endregion

    #region Unity Callbacks
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
            DontDestroyOnLoad(this.gameObject);
        }

        m_RaycastManager = arSessionOrigin.GetComponent <ARRaycastManager>();
        arCamera         = arSessionOrigin.GetComponentInChildren <Camera>();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// This is where we fill the bounding area with 1x1, 2x2 or 3x3 assets
    /// These will have collision
    /// </summary>
    private void AddBorders()
    {
        AssetPlacer Placer = new AssetPlacer();

        Placer.grid = _newGrid;

        //loop through every grid space
        for (int x = 0; x < _newGrid.roomWidth - 1; x++)
        {
            for (int y = 0; y < _newGrid.roomHeight - 1; y++)
            {
                var tileType = _newGrid.GetTileType(x, y);
                if (tileType == GridHandler.gridSpace.darkGrass)
                {
                    //if any surrounding spaces are empty, place a wall there
                    if (_newGrid.GetTileType(x, y + 1) == GridHandler.gridSpace.empty)
                    {
                        Placer.FindLargestPossibleTile(_newGrid, x, y, 0, 1);
                        _newGrid.SetTile(x, y + 1, GridHandler.gridSpace.wall);
                    }

                    if (_newGrid.GetTileType(x, y - 1) == GridHandler.gridSpace.empty)
                    {
                        Placer.FindLargestPossibleTile(_newGrid, x, y, 0, -1);
                        _newGrid.SetTile(x, y - 1, GridHandler.gridSpace.wall);
                    }

                    if (_newGrid.GetTileType(x + 1, y) == GridHandler.gridSpace.empty)
                    {
                        Placer.FindLargestPossibleTile(_newGrid, x, y, 1, 0);
                        _newGrid.SetTile(x + 1, y, GridHandler.gridSpace.wall);
                    }

                    if (_newGrid.GetTileType(x - 1, y) == GridHandler.gridSpace.empty)
                    {
                        Placer.FindLargestPossibleTile(_newGrid, x, y, -1, 0);
                        _newGrid.SetTile(x - 1, y, GridHandler.gridSpace.wall);
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
 private static void Init()
 {
     // Get existing open window or if none, make a new one:
     window = (AssetPlacer)EditorWindow.GetWindow(typeof(AssetPlacer));
     window.Show();
 }