Пример #1
0
        private void UpdateTileLayers(int[] layers)
        {
            LayerData = layers;

            for (var i = 0; i < layers.Length; ++i)
            {
                var layerData = layers[i];
                if (IsOldVisual(i, layerData))
                {
                    if (layerObjects[i] != null)
                    {
                        layerObjects[i].transform.localPosition = transform.position;
                    }
                    continue;
                }

                if (this.layerObjects[i] != null)
                {
                    TileVisualCache.FreeVisualInstance(this.layerObjects[i]);
                    this.layerObjects[i] = null;
                }

                var visual = TileVisualCache.GetTileVisualInstance(layerData);
                if (visual != null)
                {
                    visual.transform.localPosition = transform.position;
                }

                this.layerObjects[i] = visual;
            }
        }
Пример #2
0
 void Start()
 {
     chunkSize = new Vector3(chunkWidth * tileMap.Resolution, 0f, chunkHeight * tileMap.Resolution);
     TileVisualCache.Update(TileVisuals);
 }