// Update is called once per frame void OnRenderObject() { if (segmentMode == SegmentMode.Vector) { if (vectorShape == null) { if (shape == ShapeMode.Line) { vectorShape = new VectorShape(colorDriver, transform, true); } else if (shape == ShapeMode.Circle) { vectorShape = new VectorShape(colorDriver, transform, false); } } else { if (vectorMaterial) { if (shape == ShapeMode.Line) { vectorShape.Draw(transform, layoutSize.x * 0.5f, levelSize.y, travel, true, vectorAnchored, vectorAnchoredDiameter, vectorMaterial); } else if (shape == ShapeMode.Circle) { vectorShape.Draw(transform, layoutSize.x * 0.5f, levelSize.y, travel, false, vectorAnchored, vectorAnchoredDiameter, vectorMaterial); } } } } }
public void BuildLine() { Transform levelTransform; float halfSize; float spacing = CalcColumnSpacing(); halfSize = spacing * (numColumns - 1) * 0.5f; for (int i = 0; i < numColumns; i++) { levelTransform = new GameObject().transform; levelTransform.name = "Level" + i.ToString(); Vector3 pos = levelTransform.localPosition; pos.x = -halfSize + i * spacing; levelTransform.parent = transform; levelTransform.localPosition = pos; levelTransform.localScale = levelSize; levelTransform.gameObject.AddComponent <Level>(); SetLevelInfo(levelTransform.gameObject, null, numColumns, i); } vectorShape = new VectorShape(colorDriver, transform, true); }
public void BuildCircle() { int nVertices = numColumns + 1; Transform levelTransform; float spacing = CalcColumnSpacing(); float radius; float arc = (Mathf.PI * 2.0f) / (float)(nVertices - 1); if (spacingMode == SpacingMode.Spaced) { radius = spacing * (float)nVertices / Mathf.PI * 0.5f; } else { radius = layoutSize.x * 0.5f; } if (fit && spacingMode == SpacingMode.Divided) { radius -= levelSize.y * 0.5f; } for (int i = 0; i < nVertices; i++) { levelTransform = new GameObject().transform; levelTransform.name = "Level" + i.ToString(); Vector3 pos = levelTransform.localPosition; pos.x = Mathf.Cos(i * arc + Mathf.PI * 0.5f) * radius; pos.y = Mathf.Sin(i * arc + Mathf.PI * 0.5f) * radius; levelTransform.parent = transform; levelTransform.localRotation = Quaternion.AngleAxis((arc * i) * Mathf.Rad2Deg, Vector3.forward); levelTransform.localPosition = pos; levelTransform.localScale = levelSize; levelTransform.gameObject.AddComponent <Level>(); SetLevelInfo(levelTransform.gameObject, null, nVertices - 1, i); } vectorShape = new VectorShape(colorDriver, transform, false); }
private void Start() { vectorShape = null; }