Ejemplo n.º 1
0
 public override void RegisterUndo(GameObject brushTarget, GridBrushBase.Tool tool)
 {
     if (brushTarget != null)
     {
         var tilemap = brushTarget.GetComponent <Tilemap>();
         if (tilemap != null)
         {
             Undo.RecordObject(tilemap, tool.ToString());
         }
         Undo.RegisterFullObjectHierarchyUndo(brushTarget, tool.ToString());
     }
 }
Ejemplo n.º 2
0
 /// <summary>Callback for registering an Undo action before the GridBrushBase does the current GridBrushBase::ref::Tool action.</summary>
 /// <param name="brushTarget">Target of the GridBrushBase::ref::Tool operation. By default the currently selected GameObject.</param>
 /// <param name="tool">Current GridBrushBase::ref::Tool selected.</param>
 /// <remarks>Implement this for any special Undo behaviours when a brush is used.</remarks>
 public override void RegisterUndo(GameObject brushTarget, GridBrushBase.Tool tool)
 {
     if (brushTarget != null)
     {
         Undo.RegisterFullObjectHierarchyUndo(brushTarget, tool.ToString());
     }
 }
Ejemplo n.º 3
0
    public override void RegisterUndo(GameObject layer, GridBrushBase.Tool tool)
    {
        GridInformation info = BrushUtility.GetRootGridInformation(false);

        if (info != null)
        {
            Undo.RegisterFullObjectHierarchyUndo(info, tool.ToString());
        }
    }
Ejemplo n.º 4
0
 /// <summary>Callback for registering an Undo action before the GridBrushBase does the current GridBrushBase::ref::Tool action.</summary>
 /// <param name="brushTarget">Target of the GridBrushBase::ref::Tool operation. By default the currently selected GameObject.</param>
 /// <param name="tool">Current GridBrushBase::ref::Tool selected.</param>
 /// <remarks>Implement this for any special Undo behaviours when a brush is used.</remarks>
 public override void RegisterUndo(GameObject brushTarget, GridBrushBase.Tool tool)
 {
     if (brushTarget != null)
     {
         var tilemap = brushTarget.GetComponent <Tilemap>();
         if (tilemap != null)
         {
             RegisterUndoForTilemap(tilemap, tool.ToString());
         }
     }
 }
Ejemplo n.º 5
0
        public override void RegisterUndo(GameObject brushTarget, GridBrushBase.Tool tool)
        {
            if (layerBrush.brushTargets == null ||
                layerBrush.brushTargets.Length == 0)
            {
                return;
            }

            var count       = layerBrush.brushTargets.Length;
            var undoObjects = new UnityEngine.Object[count * 2];

            for (int i = 0; i < layerBrush.brushTargets.Length; i++)
            {
                undoObjects[i]         = layerBrush.brushTargets[i];
                undoObjects[i + count] = layerBrush.brushTargets[i].GetComponent <Tilemap>();
            }
            Undo.RegisterCompleteObjectUndo(undoObjects, tool.ToString());
        }
Ejemplo n.º 6
0
 public override void RegisterUndo(GameObject layer, GridBrushBase.Tool tool)
 {
     Undo.RegisterFullObjectHierarchyUndo(brush.GetLayer().gameObject, tool.ToString());
 }
Ejemplo n.º 7
0
 /// <summary>Callback for registering an Undo action before the GridBrushBase does the current GridBrushBase::ref::Tool action.</summary>
 /// <param name="brushTarget">Target of the GridBrushBase::ref::Tool operation. By default the currently selected GameObject.</param>
 /// <param name="tool">Current GridBrushBase::ref::Tool selected.</param>
 /// <remarks>Implement this for any special Undo behaviours when a brush is used.</remarks>
 public override void RegisterUndo(GameObject brushTarget, GridBrushBase.Tool tool)
 {
     if (brushTarget != null)
     {
         Undo.RegisterCompleteObjectUndo(new Object[] { brushTarget, brushTarget.GetComponent <Tilemap>() }, tool.ToString());
     }
 }
Ejemplo n.º 8
0
 public override void OnToolDeactivated(GridBrushBase.Tool tool)
 {
     (target as MyBrush).m_LastCalledEditorMethods.Add("OnToolDeactivated_" + tool.ToString());
 }