internal List <Vector3> Get_sensitive_vertices(GameObject rmc) { List <Vector3> sensitive_vertices = new List <Vector3>(); // suppose MeshVerts returns nxm unconstrained mesh Vector3[] verts = Build.GetMeshVerts(rmc); Quarter[] tile_quarters = Quarter.Generate_All_Quarters(rmc); for (int index = 0; index < verts.Length; index++) { Vector3 v = rmc.transform.TransformPoint(verts[index]); v.x = Mathf.Round(v.x); v.z = Mathf.Round(v.z); if (!Consts.IsWithinMapBounds(v)) { continue; } if (v.x % 4 == 0 && v.z % 4 == 0) { sensitive_vertices.Add(v); continue; } // find a quarter that given vertex belongs to and get information about restriction pattern Quarter quarter = tile_quarters.Aggregate( (minItem, nextItem) => Consts.Distance(minItem.pos, v) < Consts.Distance(nextItem.pos, v) ? minItem : nextItem); if (quarter.qt.Unrestricted()) { sensitive_vertices.Add(v); } else if (quarter.qt.Both_restricted()) { if (quarter.original_grid.Contains(Consts.PosToIndex(v)) && !Consts.Lies_on_any_restricted_borders(v, quarter)) { sensitive_vertices.Add(v); } } else if (quarter.qt.Horizontal_restricted()) { if (quarter.original_grid.Contains(Consts.PosToIndex(v)) && !Consts.Lies_on_restricted_border(v, BorderType.Horizontal, quarter)) { sensitive_vertices.Add(v); } } else if (quarter.qt.Vertical_restricted()) { if (quarter.original_grid.Contains(Consts.PosToIndex(v)) && !Consts.Lies_on_restricted_border(v, BorderType.Vertical, quarter)) { sensitive_vertices.Add(v); } } } return(sensitive_vertices); }