Exemplo n.º 1
0
 public Operation(string name, TileGrid.Element oldElement, TileGrid.Element newElement,
                  bool incrementOperationCounter = true)
 {
     m_Name = name;
     AddDelta(oldElement, newElement);
     m_IncrementOperationCounter = incrementOperationCounter;
 }
Exemplo n.º 2
0
    public void AddDelta(TileGrid.Element oldElement, TileGrid.Element newElement, GameObject tile = null)
    {
        if (oldElement == null && newElement == null)
        {
            return;
        }

        var gridIndex = newElement == null ? oldElement.m_GridIndex : newElement.m_GridIndex;

        var unique = ConfirmUniqueness(gridIndex);

        if (!unique)
        {
            return;
        }

        var delta = new Delta()
        {
            OldState = oldElement == null ? new TileState() : oldElement.ToState(),
            NewState = newElement == null ? new TileState() : newElement.ToState(),
        };

        delta.GridIndex = gridIndex;
        delta.Tile      = tile;

        m_Deltas.Add(delta);
    }
Exemplo n.º 3
0
 static public void AddDelta(TileGrid.Element oldElement, TileGrid.Element newElement, GameObject tile = null)
 {
     s_CurrentOperation.AddDelta(oldElement, newElement, tile);
 }