Couldn’t help myself and added a highlight to the tiles you mouse over and give some visual feedback on which ones you can “build”.
Probably jumped the gun a bit since I wouldn’t be surprised if this is something we’d add later in a course anyway. Here is a code snip for anyone interested though:
Code
public class TileWaypoint : MonoBehaviour
{
[SerializeField] bool isPlacable = false;
MeshRenderer tileMeshRenderer;
void Start()
{
tileMeshRenderer = GetComponentInChildren<MeshRenderer>();
}
void OnMouseOver()
{
if (isPlacable)
{
setTileColor(2f,2f,2f,1f);
}
else
{
setTileColor(3f,1f,1f,1f);
}
}
void OnMouseExit()
{
setTileColor(1f,1f,1f,1f);
}
void OnMouseDown()
{
Debug.Log(transform.name);
}
void setTileColor(float red, float green, float blue, float alpha)
{
Color tileColor = tileMeshRenderer.material.color;
tileColor = new Color(red,green,blue,alpha);
tileMeshRenderer.material.color = tileColor;
}
}