Esempio n. 1
0
    protected override void OnUpdate()
    {
        Dependency.Complete();

        var numDynamicBodies = m_BuildPhysicsWorld.PhysicsWorld.NumDynamicBodies;

        NativeReference <int> numEvents = new NativeReference <int>(Allocator.Persistent);

        numEvents.Value = 0;

        var getNumTriggerEventsJob = new GetNumTriggerEvents
        {
            NumTriggerEvents = numEvents
        }.Schedule(m_StepPhysicsWorld.Simulation, default);

        var getNumCollisionEventsJob = new GetNumCollisionEvents
        {
            NumCollisionEvents = numEvents
        }.Schedule(m_StepPhysicsWorld.Simulation, getNumTriggerEventsJob);

        getNumCollisionEventsJob.Complete();

        // The test is set up in a way that there is one event for each dynamic body
        Assert.IsTrue(numEvents.Value == numDynamicBodies);

        numEvents.Dispose();
    }
Esempio n. 2
0
        public void Execute()
        {
            var reference = new NativeReference <int>(Allocator.Temp);

            reference.Value = 42;
            Output.Value    = reference.Value;
            reference.Dispose();
        }
Esempio n. 3
0
    public void NativeReference_AllocateDeallocate_ReadWrite()
    {
        var reference = new NativeReference <int>(Allocator.Persistent);

        reference.Value = 1;

        Assert.That(reference.Value, Is.EqualTo(1));

        reference.Dispose();
    }
Esempio n. 4
0
    public void NativeReference_CopiedIsKeptInSync()
    {
        var reference     = new NativeReference <int>(Allocator.Persistent);
        var referenceCopy = reference;

        reference.Value = 42;

        Assert.That(reference.Value, Is.EqualTo(referenceCopy.Value));

        reference.Dispose();
    }
Esempio n. 5
0
    public void NativeReference_CopyTo()
    {
        var referenceA = new NativeReference <TestData>(Allocator.Persistent);
        var referenceB = new NativeReference <TestData>(Allocator.Persistent);

        referenceA.Value = new TestData {
            Integer = 42, Float = 3.1416f
        };
        referenceA.CopyTo(referenceB);

        Assert.That(referenceB.Value, Is.EqualTo(referenceA.Value));

        referenceA.Dispose();
        referenceB.Dispose();
    }
Esempio n. 6
0
 override public void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (!disposing)
     {
         return;
     }
     refAcquireSyncs.Dispose();
     refAcquireSyncs = null;
     refAcquireKeys.Dispose();
     refAcquireKeys = null;
     refAcquireTimeoutMilliseconds.Dispose();
     refAcquireTimeoutMilliseconds = null;
     refReleaseSyncs.Dispose();
     refReleaseSyncs = null;
     refReleaseKeys.Dispose();
     refReleaseKeys = null;
 }
        public void WithEntitiesSchedule()
        {
            var array = FilteredArray101();

            var em    = EntityManager;
            var value = new NativeReference <int>(Allocator.TempJob);

            Entities
            .WithFilter(array)
            .WithoutBurst()
            .ForEach((ref EcsTestData e1) =>
            {
                value.Value += e1.value;
                Check(em);
            })
            .Schedule();
            CompleteDependency();
            Assert.AreEqual(101, value.Value);
            array.Dispose();
            value.Dispose();
        }
 public void Dispose()
 {
     SplinePosition.Dispose();
 }
Esempio n. 9
0
 protected override void OnDestroy()
 {
     SpringDataRef.Dispose();
 }
 protected override void OnDestroy()
 {
     NumEvents.Dispose();
 }