public void SetController(GameObject gameObject, Slicer2DInputController inputController, Slicer2DVisuals visualsSettings, Slice2DLayer layerObject, Slicer2DControllerEventHandling eventHandling) { input = inputController; visuals = visualsSettings; sliceLayer = layerObject; eventHandler = eventHandling; visuals.SetGameObject(gameObject); }
public void EditorVisuals(Slicer2DVisuals id) { EditorGUI.indentLevel = EditorGUI.indentLevel + 1; id.drawSlicer = EditorGUILayout.Toggle("Enable Visuals", id.drawSlicer); if (id.drawSlicer == true) { id.sortingLayerName = EditorGUILayout.TextField("Sorting Layer Name", id.sortingLayerName); id.sortingOrder = EditorGUILayout.IntField("Soring Order", id.sortingOrder); id.zPosition = EditorGUILayout.FloatField("Slicer Z", id.zPosition); id.slicerColor = (Color)EditorGUILayout.ColorField("Slicer Color", id.slicerColor); id.visualScale = EditorGUILayout.Slider("Slicer Scale", id.visualScale, 0.5f, 50f); id.lineBorder = EditorGUILayout.Toggle("Border", id.lineBorder); if (id.lineBorder == true) // Disable? { id.borderScale = EditorGUILayout.Slider("Border Scale", id.borderScale, 1f, 5f); } id.lineWidth = EditorGUILayout.Slider("Line Width", id.lineWidth, 0.05f, 5f); id.minVertexDistance = EditorGUILayout.Slider("Min Vertex Distance", id.minVertexDistance, 0.05f, 5f); id.vertexSpace = EditorGUILayout.Slider("Vertex Space", id.vertexSpace, 0f, 1f); id.customMaterial = EditorGUILayout.Toggle("Custom Material", id.customMaterial); lineEndFoldout = EditorGUILayout.Foldout(lineEndFoldout, "Line Ending"); if (lineEndFoldout) { EditorGUI.indentLevel = EditorGUI.indentLevel + 2; id.lineEndingType = (Slicer2DLineEndingType)EditorGUILayout.EnumPopup("Type", id.lineEndingType); if (id.lineEndingType == Slicer2DLineEndingType.Circle) { id.lineEndingEdgeCount = (int)EditorGUILayout.Slider("Edges", id.lineEndingEdgeCount, 3, 30); } id.lineEndWidth = EditorGUILayout.Slider("Width", id.lineEndWidth, 0.05f, 5f); id.lineEndSize = EditorGUILayout.Slider("Size", id.lineEndSize, 0.05f, 5f); id.customEndingsImage = EditorGUILayout.Toggle("Custom Image", id.customEndingsImage); if (id.customEndingsImage) { id.customEndingImageMaterial = (Material)EditorGUILayout.ObjectField("Ending Material", id.customEndingImageMaterial, typeof(Material), true); } EditorGUI.indentLevel = EditorGUI.indentLevel - 2; } if (id.customMaterial) { id.customFillMaterial = (Material)EditorGUILayout.ObjectField("Fill", id.customFillMaterial, typeof(Material), true); id.customBoarderMaterial = (Material)EditorGUILayout.ObjectField("Boarder", id.customBoarderMaterial, typeof(Material), true); } if (id.lineWidth < 0.01f) { id.lineWidth = 0.01f; } if (id.lineEndSize < 0.05f) { id.lineEndSize = 0.05f; } if (id.minVertexDistance < 0.05f) { id.minVertexDistance = 0.05f; } } EditorGUI.indentLevel = EditorGUI.indentLevel - 1; }