public void ColShapeEnterNotCalledWhenOutOfColShape() { var server = new TestingServer(); var behaviour = server.Instantiate <CollisionShapeBehaviour>(); var collisionShape = new CollisionSphere(new Vector3(100, 100, 100), 10).AssociateWith(server);; var dummy = new DummyElement().AssociateWith(server); var isEventCalled = false; collisionShape.ElementEntered += (element) => { if (element == dummy) { isEventCalled = true; } }; dummy.Position = new Vector3(0, 100, 100); isEventCalled.Should().BeFalse(); }
public void ColShapeEnterCalledOnceForTwoUpdatesInColshape() { var server = new TestingServer(); var behaviour = server.Instantiate <CollisionShapeBehaviour>(); var collisionShape = new CollisionSphere(new Vector3(100, 100, 100), 10).AssociateWith(server);; var dummy = new DummyElement().AssociateWith(server); int callCount = 0; collisionShape.ElementEntered += (element) => { if (element == dummy) { callCount++; } }; dummy.Position = new Vector3(95, 100, 100); dummy.Position = new Vector3(97.5f, 100, 100); callCount.Should().Be(1); }