public BroadPhase(ComputeShader compute, ComputeShader computeSort, LifeService l, PositionService p)
 {
     var capacity = l.Lifes.count;
     _lifes = l;
     _positions = p;
     _kernelInitYs = compute.FindKernel(ShaderConst.KERNEL_INIT_BROADPHASE);
     _kernelSolve = compute.FindKernel (ShaderConst.KERNEL_SOVLE_BROADPHASE);
     _compute = compute;
     _sort = new BitonicMergeSort(computeSort);
     Keys = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(uint)));
     _ys = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(float)));
     Bands = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(Band)));
 }
        public HashGrid(ComputeShader compute, ComputeShader computeSort, LifeService l, PositionService p, GridService.Grid g)
        {
            var capacity = l.Lifes.count;
            _compute = compute;
            _lifes = l;
            _positions = p;

            _kernelSolve = compute.FindKernel (ShaderConst.KERNEL_SOVLE_COLLISION_DETECTION);
            _sort = new BitonicMergeSort(computeSort);
            _keys = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(uint)));
            CollisionData = new Collision[capacity];
            Collisions = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(Collision)));
            _hashes = new HashService(compute, l, p);
            _grid = new GridService(compute, g, _hashes);
        }