public static ShapeProperty Inspect(ShapeProperty shape) { shape.color = EditorGUILayout.ColorField("Color", shape.color); var border = shape.border; // Circle Style border.style = (BorderStyle)EditorGUILayout.EnumPopup("Style", border.style); if (border.style != BorderStyle.None) { border.color = EditorGUILayout.ColorField("Border Color", border.color); border.position = (BorderPosition)EditorGUILayout.EnumPopup("Border Position", border.position); border.thickness = EditorGUILayout.FloatField("Border Thickness", border.thickness * 100f) / 100f; if (border.style == BorderStyle.Dash) { border.dashLength = EditorGUILayout.FloatField("Dash Length", border.dashLength); border.gapLength = EditorGUILayout.FloatField("Gap Length", border.gapLength); } } shape.border = border; return(shape); }
public static void Apply(ShapeProperty p) { /* * if (p.GetType() == typeof(LineProperty)) { * ApplyToLine((LineProperty)p); * } else */ if (p.GetType() == typeof(RectProperty)) { ApplyToRect((RectProperty)p); } else if (p.GetType() == typeof(CircleProperty)) { ApplyToCircle((CircleProperty)p); } }
public static ShapeRenderer UpdateShapeProperty(ShapeRenderer renderer, ShapeProperty property) { switch (property.shapeType) { case ShapeType.Circle: ((CircleRenderer)renderer).property = (CircleProperty)property; break; case ShapeType.Line: ((LineRenderer)renderer).property = (LineProperty)property; break; case ShapeType.Rect: ((RectRenderer)renderer).property = (RectProperty)property; break; default: break; } return(renderer); }
public static ShapeRenderer InstantiateShape(ShapeProperty property) { ShapeRenderer shape = null; switch (property.shapeType) { case ShapeType.Circle: shape = InstantiateCircle((CircleProperty)property); break; case ShapeType.Line: shape = InstantiateLine((LineProperty)property); break; case ShapeType.Rect: shape = InstantiateRect((RectProperty)property); break; default: break; } return(shape); }
protected override void SetProperty(ShapeProperty newProperty) { property = newProperty as RectProperty; }
// Property setter protected abstract void SetProperty(ShapeProperty property);