Esempio n. 1
0
        /// <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);
            }
        }
Esempio n. 2
0
        public LinePositionIterator(GenerateRectInfo info)
        {
            _info = info;

            _beginPos = _info.Rect.position;

            _count = _info.SlicesSizeX * _info.SlicesSizeY;

            Reset();
        }
Esempio n. 3
0
 public void Dispose()
 {
     _info = null;
 }
Esempio n. 4
0
 /// <summary>
 /// Событие окончания генерации куска поля
 /// </summary>
 /// <param name="info"></param>
 private void OnGenerationEnd(GenerateRectInfo info)
 {
     _cells.FillRect(_currentCellPosition, info);
 }