void OnDestroy()//clean up stuff { StartCorner.RemoveWall(this); EndCorner.RemoveWall(this); foreach (var p in placeables) { GameObject.Destroy(p.gameObject); } foreach (var p in cutouts) { GameObject.Destroy(p.gameObject); } }
public void SetEndCorner(CornerLogic corner) { if (corner == EndCorner) { return; } if (EndCorner != null) { EndCorner.RemoveWall(this); } EndCorner = corner; if (StartCorner != null && EndCorner != null) { Length = math.distance(GetStartPosition(), GetEndPosition()); } corner.AddWall(this); if (StartCorner == null && EndCorner == null) { return; } UpdateLength(); }