/// <summary> /// Заполнить ячейки сгенерированными данными /// </summary> /// <param name="info">Данные</param> public void FillRect(Vector2Int centerPos, GenerateRectInfo info) { CellInfo cell = null; var data = info.CurrentSliceData; var pos = data.GetPos(); var count = data.GetCount(); int index = 0; while (index < count) { ushort cellItemIndex = (ushort)(index % SettingsAccess.CellPxLenght); int cellIndex = index / SettingsAccess.CellPxLenght; int cellX = cellIndex % info.CellSizeX; int cellY = cellIndex / info.CellSizeY; cell = GetOrCreateCell(centerPos, pos + new Vector2Int(cellX, cellY) * SettingsAccess.CellPxSize); index = cell.FillRatings(data, index, _playerRating); } }
public LinePositionIterator(GenerateRectInfo info) { _info = info; _beginPos = _info.Rect.position; _count = _info.SlicesSizeX * _info.SlicesSizeY; Reset(); }
public void Dispose() { _info = null; }
/// <summary> /// Событие окончания генерации куска поля /// </summary> /// <param name="info"></param> private void OnGenerationEnd(GenerateRectInfo info) { _cells.FillRect(_currentCellPosition, info); }