Beispiel #1
0
        public void ReturnTileInstance(TileInstanceObject tileInstance)
        {
            tileInstance.instance.SetActive(false);
            var tilePool = pool[tileInstance.id];

            if (!tilePool.Contains(tileInstance))
            {
                tilePool.Add(tileInstance);
            }
        }
Beispiel #2
0
        public TileInstanceObject CreateTileInstance(int id)
        {
            var tile     = tileset.LookupTile(id);
            var instance = tile.CreateTileInstance();

            instance.transform.SetParent(tileParent);

            // Hide objects in editor
            #if UNITY_EDITOR
            // Disable picking so the tile mesh faces can be selected through the tile geometry
            SceneVisibilityManager.instance.DisablePicking(instance, true);
            // Hide the tile objects in the scene view
            instance.hideFlags = HideFlags.HideInHierarchy;
            #endif

            var instanceObj = new TileInstanceObject(id, instance);
            allTiles.Add(instanceObj);

            return(instanceObj);
        }