示例#1
0
        public void TestInequality()
        {
            var a1 = new ComponentAccessor(typeof(ISimpleComponent));
            var a2 = new ComponentAccessor(typeof(IOtherSimpleComponent));

            (a1 != a2).ShouldBeTrue();
        }
        public void TestInequality()
        {
            var a1 = new ComponentAccessor(typeof(ISimpleComponent));
            var a2 = new ComponentAccessor(typeof(IOtherSimpleComponent));

            (a1 != a2).ShouldBeTrue();
        }
示例#3
0
        /// <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;
 }
示例#5
0
 public static Type GetType(ComponentAccessor accessor)
 {
     return _ids.Single(p => p.Value == accessor.Id).Key;
 }
示例#6
0
 /// <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);
 }
示例#7
0
 public EntityComponentModified(uint entityId, ComponentAccessor componentAccessor)
 {
     EntityId = entityId;
     ComponentAccessor = componentAccessor;
 }