hellbound/Assets/Scripts/Game/UI/Market/Previews/BaseItemPreviewer.cs

31 lines
889 B
C#

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<Material>("Market/shop_shade");
}
protected void ShadeObject(GameObject obj)
{
var allRenderers = obj.GetComponentsInChildren<Renderer>();
foreach (var renderer in allRenderers)
{
var shadedMaterials = renderer.materials;
for (var i = 0; i < shadedMaterials.Length; i++)
shadedMaterials[i] = _shadeMaterial;
renderer.materials = shadedMaterials;
}
}
}