public HexagonCell GetCell(Vector3 position) { position = transform.InverseTransformPoint(position); HexagonCoord coordinates = HexagonCoord.FromPosition(position); int index = coordinates.X_coord + coordinates.Z_coord * width + coordinates.Z_coord / 2; return(cells[index]); }
void TouchCell(Vector3 position) { position = transform.InverseTransformPoint(position); HexagonCoord coordinates = HexagonCoord.FromPosition(position); int index = coordinates.X_coord + coordinates.Z_coord * width + coordinates.Z_coord / 2; Debug.Log(index); HexagonCell cell = cells[index]; cell.color = touchedColor; hexMesh.Triangulate(cells); }