Exemple #1
0
    private IEnumerator QueueAddRow()
    {
        var yScale = MapController.AddGridRow(infinite: true);
        var rowM   = rowMover.FirstOrDefault();

        if (rowM == null)
        {
            yield return(null);
        }
        if (rowM.rowIndex == 0)
        {
            MapController.DescendRows(yScale, _gridRowPool);
        }
        else
        {
            MapController.DescendRows(yScale, _gridRowPool.Where(r => r.Index > rowM.rowIndex));
            if (rowM.deletedRowHeight < yScale)
            {
                var valueToMoveTheBottomRows = yScale - rowM.deletedRowHeight;
                MapController.DescendRows(valueToMoveTheBottomRows, _gridRowPool.Where(r => r.Index < rowM.rowIndex));
            }
        }
        yield return(new WaitForSeconds(TimeForRowsToDescend));

        rowMover.Remove(rowM);

        if (rowMover.Count > 0)
        {
            _queueAddRow = QueueAddRow();
            StartCoroutine(_queueAddRow);
        }
        else
        {
            _queueAddRow = null;
        }
    }