public List<Edge> GetEdges(Cell origin) { var edges = new List<Edge>(); if (origin.direction != Directions.Left) { var edge = new Edge(origin.x, origin.y, Directions.Right, origin.depth); if (Contains(edge.exit) && this[edge.exit] == Directions.None) { edges.Add(edge); } } if (origin.direction != Directions.Right) { var edge = new Edge(origin.x, origin.y, Directions.Left, origin.depth); if (Contains(edge.exit) && this[edge.exit] == Directions.None) { edges.Add(edge); } } if (origin.direction != Directions.Down) { var edge = new Edge(origin.x, origin.y, Directions.Up, origin.depth); if (Contains(edge.exit) && this[edge.exit] == Directions.None) { edges.Add(edge); } } if (origin.direction != Directions.Up) { var edge = new Edge(origin.x, origin.y, Directions.Down, origin.depth); if (Contains(edge.exit) && this[edge.exit] == Directions.None) { edges.Add(edge); } } return edges; }
public void AddEdge(Edge edge) { this[edge.origin] |= edge.origin.direction; this[edge.exit] = edge.exit.direction; }
private void DrawEdge(Edge edge) { int x, y, width, height; if (edge.origin.direction == Directions.Left || edge.origin.direction == Directions.Down) { x = Translate(edge.exit.x); y = Translate(edge.exit.y); } else { x = Translate(edge.origin.x); y = Translate(edge.origin.y); } if (edge.origin.direction == Directions.Left || edge.origin.direction == Directions.Right) { width = cellSize*2 + cellWallSize; height = cellSize; } else { width = cellSize; height = cellSize*2 + cellWallSize; } var color = rainbow ? ColorE.HSVToRGB(Mathf.Repeat(edge.origin.depth/360f, 1), 1, 1) : Color.white; texture.DrawRect(x, y, width, height, color); }