// This event called when tile texture changed.
        private void OnChangeMaterialTexture(OnlineMapsTile tile, Material material)
        {
            // Try get tile from list
            TilesetFadeExampleItem item = items.FirstOrDefault(i => i.tile == tile);

            // if there is custom data associated with 'tile', just update it
            if (item != null)
            {
                item.material = material;
                item.Update();
            }
            // else a animation data was not found in the master list but if there is custom data associated with 'tile'
            else if (tile.customData != null)
            {
                item = (TilesetFadeExampleItem) tile.customData;
                if (!item.finished)
                {
                    items.Add(item);
                    item.Update();
                }
                else material.color = TilesetFadeExampleItem.toColor;
            }
            // else if the tile has a texture and that texture is not a default texture
            else if (tile.texture != null && tile.texture != OnlineMaps.instance.defaultTileTexture)
            {
                item = new TilesetFadeExampleItem(tile, material);
                item.Update();
                items.Add(item);
            }
            // else set initial color
            else
            {
                material.color = TilesetFadeExampleItem.fromColor;
            }
        }
Esempio n. 2
0
        // This event called when tile texture changed.
        private void OnChangeMaterialTexture(OnlineMapsTile tile, Material material)
        {
            // Try get tile from list
            TilesetFadeExampleItem item = items.FirstOrDefault(i => i.tile == tile);

            // if there is custom data associated with 'tile', just update it
            if (item != null)
            {
                item.material = material;
                item.Update();
            }
            // else a animation data was not found in the master list but if there is custom data associated with 'tile'
            else if (tile.customData != null)
            {
                item = (TilesetFadeExampleItem)tile.customData;
                if (!item.finished)
                {
                    items.Add(item);
                    item.Update();
                }
                else
                {
                    material.color = TilesetFadeExampleItem.toColor;
                }
            }
            // else if the tile has a texture and that texture is not a default texture
            else if (tile.texture != null && tile.texture != OnlineMaps.instance.defaultTileTexture)
            {
                item = new TilesetFadeExampleItem(tile, material);
                item.Update();
                items.Add(item);
            }
            // else set initial color
            else
            {
                material.color = TilesetFadeExampleItem.fromColor;
            }
        }