private void DrawRectangle(singleBox e, Color color, float width = 0.03f) { e.ob1 = DrawLine(Base, new Vector3(e.start.x, e.start.y), new Vector3(e.start.x, e.end.y), color, width); e.ob2 = DrawLine(Base, new Vector3(e.start.x, e.end.y), new Vector3(e.end.x, e.end.y), color, width); e.ob3 = DrawLine(Base, new Vector3(e.start.x, e.start.y), new Vector3(e.end.x, e.start.y), color, width); e.ob4 = DrawLine(Base, new Vector3(e.end.x, e.start.y), new Vector3(e.end.x, e.end.y), color, width); }
private void RemoveRect(singleBox box) { Destroy(box.ob1); Destroy(box.ob2); Destroy(box.ob3); Destroy(box.ob4); }
private void ChooseStartBox(singleBox box) { DrawMap(); point[0] = new singleBox(box); Debug.Log("start point: " + point[0].start); fillIcon(box, icon_start); }
private void ChooseEndBox(singleBox box) { point[1] = new singleBox(box); Debug.Log("end point: " + point[1].start); fillIcon(box, icon_end); var x = StartCoroutine(FindWays()); isfind = true; }
private void ChooseBox(singleBox box) { if (point[0] == null || point[0] != null && point[1] != null || point[0].Equals(point[1])) { point[0] = null; point[1] = null; ChooseStartBox(box); } else { ChooseEndBox(box); } }
private void DrawMap() { ClearChild(Base); for (int i = 0; i < max_w; i++) { for (int j = max_h; j > 0; j--) { Vector2 start = new Vector2(firstPosition.x + size.x * i, firstPosition.y - size.y * (max_h - j)); Vector2 end = new Vector2(firstPosition.x + size.x * i + size.x, firstPosition.y - size.y * (max_h - j) - size.y); var box = new singleBox(start, end); listBox.Add(box); DrawRectangle(box, color_def); } } }
public singleBox(singleBox box) { this.start = box.start; this.end = box.end; }
private void fillIcon(singleBox e, GameObject icon) { Instantiate(icon, Base).transform.position = new Vector3(e.start.x + size.x / 2, e.start.y - size.y / 2); }