using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class UndoMaskedVertices : IUndoAction {

    private Color[] _originalVertexColors;
    public Color[] OriginalVertexColors
    {
        get
        {
            return _originalVertexColors;
        }
        set
        {
            _originalVertexColors = new Color[value.Length];
            Array.Copy(value, _originalVertexColors, value.Length);
        }
    }


    private int[] _originalMaskedVertices;
    public int[] OriginalMaskedVertices
    {
        get
        {
            return _originalMaskedVertices;
        }
        set
        {
            _originalMaskedVertices = new int[value.Length];
            Array.Copy(value, _originalMaskedVertices, value.Length);
        }
    }

    public void RevertAction(DeformationManager manager)
    {
        manager.MaskedVertices = _originalMaskedVertices;
        manager.CurrentVertexColors = _originalVertexColors;
        manager.DeformingMesh.colors = _originalVertexColors;
    }

    public void SetupUndoAction(DeformationManager manager)
    {
        OriginalMaskedVertices = manager.MaskedVertices;
        OriginalVertexColors = manager.CurrentVertexColors;
    }
}
