Ejemplo n.º 1
0
    public void Execute()
    {
        var navmesh   = Navmesh[0];
        var validator = new LctValidator(ref navmesh, Allocator.Temp);

        var vertices       = new NativeList <float2>(Allocator.Temp);
        var amounts        = new NativeList <int>(Allocator.Temp);
        var entities       = new NativeList <Entity>(Allocator.Temp);
        var bufferEntities = new NativeArray <Entity>(0, Allocator.Temp);
        var blobEntities   = new NativeArray <Entity>(0, Allocator.Temp);

        var start = 0;

        for (int i = 0; i < Amounts.Length; i++)
        {
            var amount = Amounts[i];
            var end    = start + amount;
            for (int j = start; j < end; j++)
            {
                vertices.Add(Points[j]);
            }
            amounts.Add(amount);
            entities.Add(ObstacleEntities[i]);
            start += amount;

            navmesh.Update(vertices, amounts, entities, ToRemove, Destroyed, default, default, bufferEntities, default, blobEntities);
Ejemplo n.º 2
0
    public unsafe void Execute()
    {
        var navmesh   = Navmesh[0];
        var validator = new LctValidator(navmesh.Navmesh, Allocator.Temp);

        var vertices       = new NativeList <float2>(Allocator.Temp);
        var amounts        = new NativeList <int>(Allocator.Temp);
        var entities       = new NativeList <Entity>(Allocator.Temp);
        var bufferEntities = new NativeArray <Entity>(0, Allocator.Temp);
        var blobEntities   = new NativeArray <Entity>(0, Allocator.Temp);

        for (int i = 0; i < ConstraintIds.Length; i++)
        {
            ToRemove.Enqueue(ConstraintIds[i]);
            // todo fix test
            // navmesh.Navmesh->Update(vertices, amounts, entities, ToRemove, Destroyed, default, default, bufferEntities, default, blobEntities);
            validator.Validate(navmesh.Navmesh, Validation);
        }

        Navmesh[0] = navmesh;

        if (validator.ClearanceCalculated > 0)
        {
            Debug.Log($"Clearance calculated: {validator.ClearanceCalculated}");
        }
        validator.Dispose();
    }
Ejemplo n.º 3
0
    public void Execute()
    {
        var navmesh   = Navmesh[0];
        var validator = new LctValidator(ref navmesh, Allocator.Temp);

        var vertices       = new NativeList <float2>(Allocator.Temp);
        var amounts        = new NativeList <int>(Allocator.Temp);
        var entities       = new NativeList <Entity>(Allocator.Temp);
        var bufferEntities = new NativeArray <Entity>(0, Allocator.Temp);
        var blobEntities   = new NativeArray <Entity>(0, Allocator.Temp);

        for (int i = 0; i < ConstraintIds.Length; i++)
        {
            ToRemove.Enqueue(ConstraintIds[i]);
            navmesh.Update(vertices, amounts, entities, ToRemove, Destroyed, default, default, bufferEntities, default, blobEntities);
Ejemplo n.º 4
0
    public unsafe void Execute()
    {
        var navmesh   = Navmesh[0];
        var validator = new LctValidator(navmesh.Navmesh, Allocator.Temp);

        var vertices       = new NativeList <float2>(Allocator.Temp);
        var amounts        = new NativeList <int>(Allocator.Temp);
        var entities       = new NativeList <Entity>(Allocator.Temp);
        var bufferEntities = new NativeArray <Entity>(0, Allocator.Temp);
        var blobEntities   = new NativeArray <Entity>(0, Allocator.Temp);

        var start = 0;

        for (int i = 0; i < Amounts.Length; i++)
        {
            var amount = Amounts[i];
            var end    = start + amount;
            for (int j = start; j < end; j++)
            {
                vertices.Add(Points[j]);
            }
            amounts.Add(amount);
            entities.Add(ObstacleEntities[i]);
            start += amount;

            // todo fix test
            // navmesh.Navmesh->Update(vertices, amounts, entities, ToRemove, Destroyed, default, default, bufferEntities, default, blobEntities);
            validator.Validate(navmesh.Navmesh, Validation);

            vertices.Clear();
            amounts.Clear();
            entities.Clear();
        }

        Navmesh[0] = navmesh;

        if (validator.ClearanceCalculated > 0)
        {
            Debug.Log($"Clearance calculated: {validator.ClearanceCalculated}");
        }
        validator.Dispose();
    }