public void setPopupText(string text, Vector2 textGridPos)
{
_shouldHidePopupText = false;
float textX = textGridPos.x;
if (textX < 2)
{
textX = 2;
}
if (textX > 13)
{
textX = 13;
}
float textY = textGridPos.y + 1;
_popupText.anchor = TextAnchor.LowerCenter;
if (textY > Globals.ROOM_HEIGHT - 2)
{
textY = textGridPos.y;
_popupText.anchor = TextAnchor.UpperCenter;
}
Vector2 actualPos = toActualCoordinates(new Vector2(textX, textY));
_popupText.transform.localPosition = new Vector3(actualPos.x, actualPos.y - Globals.CELL_SIZE / 2, _popupText.transform.localPosition.z);
_popupText.text = text;
_popupText.Commit();
_popupText.gameObject.SetActive(true);
}