Ejemplo n.º 1
0
    public void UpdateBufferData(int index, ProjectileType projectileType, ProjectileData data)
    {
        if (projectileType.Index != LastAccessedProjectileTypeIndex)
        {
            LastAccessedProjectileTypeIndex = projectileType.Index;
            LastAccessedRenderer            = IndirectRenderers[LastAccessedProjectileTypeIndex];
        }

        LastAccessedRenderer.UpdateBufferData(projectileType.BufferIndex, data);
        projectileType.BufferIndex++;
    }
    // Start is called before the first frame update
    private void Start()
    {
        _positions = new NativeArray <float3>(NumObjects, Allocator.Persistent);

        _filteredIndices = new NativeList <int>(NumObjects, Allocator.Persistent);

        Unity.Mathematics.Random rand = new Unity.Mathematics.Random(123);

        for (int i = 0; i < NumObjects; i++)
        {
            _positions[i] = rand.NextFloat3Direction() * rand.NextFloat(1f, 50f);
        }

        _renderer = new IndirectRenderer(NumObjects, Material, Mesh);
    }