using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class TileRender : MonoBehaviour { public new SpriteRenderer renderer; public TextMeshPro textMesh; public int id; public SpriteRenderer Chains; public void SetDisplay(TileColor color, TileKind kind) { SetDisplay(null, color, kind); } public void ClearDisplay(){ renderer.sprite = null; } public void SetDisplay(TileInfo tile, TileColor color, TileKind kind){ Sprite[] sprites; Chains.enabled = kind.Equals(TileKind.Trash); switch(kind){ case TileKind.Block: case TileKind.Trash: sprites = GameBoardInstance.instance.regular; break; case TileKind.Activator: sprites = GameBoardInstance.instance.activators; break; case TileKind.Activiting: sprites = GameBoardInstance.instance.lit; break; case TileKind.Special: int timeSprite = (int)(Time.time * 4); renderer.sprite = GameBoardInstance.instance.activators[timeSprite % 4]; return; default: sprites = null; Debug.LogErrorFormat(this.gameObject,"{0}, {1}, {2} not supported by tile display", tile.color, tile.kind, tile.counter); //Debug.LogFormat("TileInfo Instance {0}",TileInfo._instance); break; } var s = sprites[(int)color]; renderer.sprite = s; } public void SetCounter(string text){ textMesh.text = text; } }