52 lines
919 B
C#
52 lines
919 B
C#
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class TileComponent : MonoBehaviour
|
|
{
|
|
public int x;
|
|
public int y;
|
|
|
|
public Tile tile;
|
|
|
|
public TMP_Text coordinatesText;
|
|
|
|
// is buildable
|
|
|
|
// Start is called before the first frame update
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
public void SetTile(int x, int y)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
|
|
public void SetCoordinatesText()
|
|
{
|
|
coordinatesText = gameObject.transform.Find("Coord").GetComponent<TMP_Text>();
|
|
coordinatesText.text = x + "x" + y;
|
|
}
|
|
|
|
|
|
public void Initialize(int posX, int posY, Tile gSpace)
|
|
{
|
|
tile = gSpace;
|
|
SetTile(posX, posY);
|
|
SetCoordinatesText();
|
|
DrawTileBorder();
|
|
}
|
|
|
|
|
|
public bool IsOccupied()
|
|
{
|
|
return tile.Interactable != null;
|
|
}
|
|
|
|
private void DrawTileBorder()
|
|
{
|
|
// add black border around tile
|
|
}
|
|
} |