public void DrawWires() { if (enabled) { GizmoTurtle.WithGizmoColor(Color.yellow, () => { Gizmos.DrawWireSphere(transform.position, 0.1f); }); } else { GizmoTurtle.WithGizmoColor(Color.gray, () => { Gizmos.DrawWireSphere(transform.position, 0.1f); }); } GizmoTurtle.WithGizmoColor(Color.white, () => { foreach (FieldInfo field in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)) { List <CircuitComponent> components = field.GetValue(this) as List <CircuitComponent>; if (components != null) { foreach (CircuitComponent component in components) { if (field.Name.ToLower() != "next") { DrawWire(Regex.Replace(field.Name, @"[A-Z]", " $0").Trim(), component.transform.position); } else { DrawWire("", component.transform.position); } } } if (this is CircuitDictionaryComponent) { foreach (CircuitDictionaryItem item in (this as CircuitDictionaryComponent).transitions) { foreach (CircuitComponent component in item.transition) { if (item.transitionName.ToLower() != "next") { DrawWire(Regex.Replace(item.transitionName, @"[A-Z]", " $0").Trim(), component.transform.position); } else { DrawWire("", component.transform.position); } } } } } }); }
public void DrawLabel() { GizmoTurtle.WithGizmoColor(Color.white, () => { GizmoTurtle turtle = new GizmoTurtle(transform.position); RobotLetters font = new RobotLetters(turtle, 0.1f); turtle.Forward(0.15f); turtle.RotateRight(90); turtle.Forward(0.02f); turtle.RotateLeft(90); font.Write(Regex.Replace(name, @"[A-Z]", " $0").Trim()); }); }