public override bool ProcessSpatialConstraint(SpatialConstraint constraint, PropSocket socket, DungeonModel model, List <PropSocket> levelSockets, out Matrix4x4 outOffset) { outOffset = Matrix4x4.identity; if (constraint is SpatialConstraintGrid7x7) { return(Process7x7(constraint as SpatialConstraintGrid7x7, socket, model, ref outOffset)); } if (constraint is SpatialConstraintGrid5x5) { return(Process5x5(constraint as SpatialConstraintGrid5x5, socket, model, ref outOffset)); } if (constraint is SpatialConstraintGrid3x3) { return(Process3x3(constraint as SpatialConstraintGrid3x3, socket, model, ref outOffset)); } if (constraint is SpatialConstraintGrid2x2) { return(Process2x2(constraint as SpatialConstraintGrid2x2, socket, model, ref outOffset)); } if (constraint is SpatialConstraintGrid1x2) { return(Process1x2(constraint as SpatialConstraintGrid1x2, socket, model, ref outOffset)); } return(false); }
void DrawSpatialConstraint(SpatialConstraint constraint) { if (constraint == null) { return; } var editorTypes = ReflectionUtils.GetAllSubtypes(typeof(SpatialConstraintEditor), false); foreach (var editorType in editorTypes) { var editorAttribute = System.Attribute.GetCustomAttribute(editorType, typeof(ConstraintEditorAttribute)) as ConstraintEditorAttribute; if (editorAttribute != null) { if (editorAttribute.constraintType == constraint.GetType()) { var editor = ScriptableObject.CreateInstance(editorType) as SpatialConstraintEditor; editor.DrawConstraintEditor(constraint); ScriptableObject.DestroyImmediate(editor); editor = null; break; } } } }
public override void DrawConstraintEditor(SpatialConstraint constraint) { var constraint7x7 = constraint as SpatialConstraintGrid7x7; if (constraint7x7.cells == null || constraint7x7.cells[0] == null) { // gets invalidated during code change / hot-reloading throw new System.ApplicationException("invalid state"); } var cells = constraint7x7.cells; for (int row = 0; row < 7; row++) { EditorGUILayout.BeginHorizontal(); DrawGridCell(cells[row * 7 + 0]); DrawGridCell(cells[row * 7 + 1]); DrawGridCell(cells[row * 7 + 2]); DrawGridCell(cells[row * 7 + 3]); DrawGridCell(cells[row * 7 + 4]); DrawGridCell(cells[row * 7 + 5]); DrawGridCell(cells[row * 7 + 6]); EditorGUILayout.EndHorizontal(); } }
public override bool ProcessSpatialConstraint(SpatialConstraint constraint, PropSocket socket, DungeonModel model, List <PropSocket> levelSockets, out Matrix4x4 outOffset) { outOffset = Matrix4x4.identity; if (constraint is SpatialConstraintGrid3x3) { return(Process3x3(constraint as SpatialConstraintGrid3x3, socket, model)); } return(false); }
public override void DrawConstraintEditor(SpatialConstraint constraint) { var constraint1x2 = constraint as SpatialConstraintGrid1x2; EditorGUILayout.BeginHorizontal(); DrawGridCell(constraint1x2.left); DrawGridCell(constraint1x2.right); EditorGUILayout.EndHorizontal(); }
public virtual void DrawConstraintEditor(SpatialConstraint constraint) { GUILayout.Label("Editor not implemented"); }
protected virtual bool ProcessSpatialConstraint(SpatialConstraintProcessor constraintProcessor, SpatialConstraint constraint, PropSocket socket, out Matrix4x4 OutOffset) { if (constraintProcessor == null) { OutOffset = Matrix4x4.identity; return(false); } return(constraintProcessor.ProcessSpatialConstraint(constraint, socket, model, propSockets, out OutOffset)); }