public bool Borders(Edge edge) { var aIndex = Circumference.IndexOf(edge.A); if (aIndex == -1) { return(false); } var nextIndex = (aIndex + 1) % Circumference.Count; var prevIndex = aIndex > 0 ? aIndex - 1 : Circumference.Count - 1; if (Circumference[nextIndex] == edge.B || Circumference[prevIndex] == edge.B) { return(true); } return(false); }
public void ReplaceWallPoint(Vector2 oldPoint, Vector2 newPoint) { var index = Circumference.IndexOf(oldPoint); if (index >= 0) { Circumference[index] = newPoint; } var gateIndex = Gates.IndexOf(oldPoint); if (gateIndex >= 0) { Gates[gateIndex] = newPoint; } var towerIndex = Towers.IndexOf(oldPoint); if (towerIndex >= 0) { Towers[towerIndex] = newPoint; } }