45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
|
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 void SetDisplay(TileColor color, TileKind kind) {
|
|||
|
SetDisplay(null, color, kind);
|
|||
|
}
|
|||
|
|
|||
|
public void SetDisplay(TileInfo tile, TileColor color, TileKind kind){
|
|||
|
Sprite[] sprites;
|
|||
|
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;
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
}
|