Beispiel #1
0
        private void RemoveAndUnlinkGameObject(long entityId, GameObject gameObject)
        {
            connectionHandler.RemoveComponent(entityId, Position.ComponentId);
            connectionHandler.RemoveEntity(entityId);
            receiveSystem.Update();
            requireLifecycleSystem.Update();

            Object.DestroyImmediate(gameObject);
        }
        public void Component_updates_are_dropped_if_component_removed()
        {
            CreateEntity();
            Update();

            UpdatePosition();
            connectionHandler.RemoveComponent(entityId: 10, Position.ComponentId);
            Update();

            var updates = componentUpdateSystem.GetComponentUpdatesReceived <Position.Update>();

            Assert.AreEqual(expected: 0, updates.Count);

            var entitySpecificUpdates =
                componentUpdateSystem.GetEntityComponentUpdatesReceived <Position.Update>(new EntityId(10));

            Assert.AreEqual(expected: 0, entitySpecificUpdates.Count);
        }