53 lines
930 B
C#
53 lines
930 B
C#
using TMPro;
|
|
using Types.Map;
|
|
using UnityEngine;
|
|
|
|
public class TileComponent : MonoBehaviour
|
|
{
|
|
public int x;
|
|
public int y;
|
|
|
|
public TMP_Text coordinatesText;
|
|
|
|
public Tile Tile;
|
|
|
|
// is buildable
|
|
|
|
// Start is called before the first frame update
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
public void SetTile(int _x, int _y)
|
|
{
|
|
x = _x;
|
|
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
|
|
}
|
|
} |