public void UpdateHeightmapSegmentFillingState(Dictionary <HeightPyramidLevel, Dictionary <IntVector2, SegmentGenerationProcessTokenWithFillingNecessity> > tokens)
        {
            var fillingStateArray = new GpuSingleSegmentState[_slotMapSize.X * _slotMapSize.Y * _levels.Count];

            foreach (var pair in tokens.OrderBy(c => c.Key.GetIndex()))
            {
                FillStateArrayFromSoleLevelData(pair.Value, fillingStateArray, pair.Key.GetIndex() * _slotMapSize.X * _slotMapSize.Y);
            }

            _fillingStateBuffer.SetData(fillingStateArray);
        }
        private void FillStateArrayFromSoleLevelData(Dictionary <IntVector2, SegmentGenerationProcessTokenWithFillingNecessity> tokens, GpuSingleSegmentState[] fillingStateArray, int fillingStateArrayOffset)
        {
            var tokensArray = new   SegmentGenerationProcessTokenWithFillingNecessity[_slotMapSize.X * _slotMapSize.Y];

            foreach (var pair in tokens)
            {
                var moddedCoords = new IntVector2((pair.Key.X + _slotMapSize.X * 32) % _slotMapSize.X, (pair.Key.Y + _slotMapSize.Y * 32) % _slotMapSize.Y);
                tokensArray[moddedCoords.X + moddedCoords.Y * _slotMapSize.X] = pair.Value;
            }

            for (int x = 0; x < _slotMapSize.X; x++)
            {
                for (int y = 0; y < _slotMapSize.Y; y++)
                {
                    var index = x + y * _slotMapSize.Y;
                    var token = tokensArray[index];
                    var state = new GpuSingleSegmentState()
                    {
                        IsProcessOnGoing       = 0,
                        CurrentSituationIndex  = 0,
                        RequiredSituationIndex = 0
                    };
                    if (token != null)
                    {
                        if (token.Token.ProcessIsOngoing)
                        {
                            state.IsProcessOnGoing = 1;
                        }

                        state.CurrentSituationIndex  = (int)token.Token.CurrentSituation;
                        state.RequiredSituationIndex = (int)token.Token.RequiredSituation;
                        state.FillingIsNecessary     = token.FillingIsNecessary ? 1 : 0;
                    }

                    fillingStateArray[index + fillingStateArrayOffset] = state;
                }
            }
        }