using game; using UnityEngine; public abstract class BaseItemPreviewer : MonoBehaviour { public abstract void ChangeItem(ConfBaseShopItem itemConf, bool needShade); public abstract void Show(bool skipAnimation = true); public abstract void Hide(bool skipAnimation = true); private Material _shadeMaterial; private void Awake() { _shadeMaterial = Assets.Load("Market/shop_shade"); } protected void ShadeObject(GameObject obj) { var allRenderers = obj.GetComponentsInChildren(); foreach (var renderer in allRenderers) { var shadedMaterials = renderer.materials; for (var i = 0; i < shadedMaterials.Length; i++) shadedMaterials[i] = _shadeMaterial; renderer.materials = shadedMaterials; } } }