public void TestResetSingleComponent() { var dirtyTracker = new EntityDirtyTracker(); dirtyTracker.TrySetDirty(ComponentMap <ISimpleComponent> .Accessor).ShouldBeTrue(); dirtyTracker.TrySetDirty(ComponentMap <ISimpleComponent> .Accessor).ShouldBeFalse(); dirtyTracker.Reset(ComponentMap <ISimpleComponent> .Accessor); dirtyTracker.TrySetDirty(ComponentMap <ISimpleComponent> .Accessor).ShouldBeTrue(); }
/// <summary> /// Commit all changes to dirty components. Not thread safe. /// </summary> internal void Commit() { foreach (var kv in _components) { if (!_dirtyTracker.TrySetDirty(kv.Key)) { kv.Value.CommitChanges(); } } _dirtyTracker.Reset(); }