public void TestInequality() { var a1 = new ComponentAccessor(typeof(ISimpleComponent)); var a2 = new ComponentAccessor(typeof(IOtherSimpleComponent)); (a1 != a2).ShouldBeTrue(); }
/// <summary> /// Set the component with <paramref name="accessor"/> to be dirty. /// </summary> /// <param name="accessor">Component accessor to mark as dirty.</param> /// <returns>True if successfully marked component as dirty. False if component is already dirty.</returns> public bool TrySetDirty(ComponentAccessor accessor) { var id = accessor.Id; if (_dirtyComponents.TryAdd(id, true)) return true; if (!_dirtyComponents.TryUpdate(id, true, false)) { return false; } return true; }
public EntityComponentModified(uint entityId, ComponentAccessor componentAccessor) { EntityId = entityId; ComponentAccessor = componentAccessor; }
public static Type GetType(ComponentAccessor accessor) { return _ids.Single(p => p.Value == accessor.Id).Key; }
/// <summary> /// Reset component with <paramref name="accessor"/> to be not-dirty. /// </summary> /// <param name="accessor">Component accessor to mark as not-dirty.</param> public void Reset(ComponentAccessor accessor) { _dirtyComponents.AddOrUpdate(accessor.Id, false, (i, b) => false); }