Exemple #1
0
 /// <summary>
 /// Execute a callback on all tile batches in tilemap.
 /// </summary>
 /// <param name="callback">Function to execute (called with batch root GameObject and index).</param>
 public void ProcessTileBatches(ProcessTileCallback callback)
 {
     foreach (KeyValuePair <int, Dictionary <int, TilesBatch> > row in _batches)
     {
         foreach (KeyValuePair <int, TilesBatch> batch in row.Value)
         {
             callback(batch.Value.BatchRoot, batch.Value.Index);
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// Execute a callback on all tiles in tilemap.
        /// </summary>
        /// <param name="callback">Function to execute (called with tile GameObject and index).</param>
        public void ProcessTiles(ProcessTileCallback callback)
        {
            string intDataKey = InternalDataKey;

            foreach (KeyValuePair <int, Dictionary <int, TilesBatch> > row in _batches)
            {
                foreach (KeyValuePair <int, TilesBatch> batch in row.Value)
                {
                    foreach (GameObject tile in batch.Value.Tiles)
                    {
                        if (tile != null)
                        {
                            callback(tile, (Point)tile.GetInternalData(ref intDataKey));
                        }
                    }
                }
            }
        }