Example #1
0
        /// <summary>Adds the specified entity.</summary>
        /// <param name="entity">The entity.</param>
        protected void Add(Entity entity)
        {
            Debug.Assert(entity != null, "Entity must not be null.");

            entity.AddSystemBit(this.Bit);
            if (entity.IsEnabled)
            {
                this.Enable(entity);
            }

            this.OnAdded(entity);
        }
		public void Change(Entity e) {
			bool contains = (systemBit & e.GetSystemBits()) == systemBit;
			bool interest = (typeFlags & e.GetTypeBits()) == typeFlags;
	
			if (interest && !contains && typeFlags > 0) {
				actives.Add(e.GetId(),e);
				e.AddSystemBit(systemBit);
				Added(e);
			} else if (!interest && contains && typeFlags > 0) {
				Remove(e);
			}
		}
        /// <summary>
        /// Handles any actions required when an <see cref="Entity"/> has changed.
        /// </summary>
        /// <param name="entity">The <see cref="Entity"/> that was changed.</param>
        public void Change(Entity entity)
        {
            bool contains = (SystemBit & entity.SystemBits) == SystemBit;
            bool interest = (_typeFlags & entity.TypeBits) == _typeFlags;

            if (interest && !contains && (_typeFlags > 0))
            {
                _activeEntities.Add(entity.Id, entity);
                entity.AddSystemBit(SystemBit);
                Added(entity);
            }
            else if (!interest && contains && (_typeFlags > 0))
            {
                Remove(entity);
            }
        }
Example #4
0
        /// <summary>Adds the specified entity.</summary>
        /// <param name="entity">The entity.</param>
        protected void Add(Entity entity)
        {
            Debug.Assert(entity != null, "Entity must not be null.");

            entity.AddSystemBit(this.SystemBit);
            if (entity.IsEnabled)
            {
                this.Enable(entity);
            }

            this.OnAdded(entity);
        }
Example #5
0
 protected void Add(Entity e)
 {
     System.Diagnostics.Debug.Assert(e != null);
     e.AddSystemBit(systemBit);
     if (e.Enabled == true) {
         Enable(e);
     }
     Added(e);
 }
 protected void Add(Entity e)
 {
     e.AddSystemBit(systemBit);
     if (e.Enabled == true) {
         Enable(e);
     }
     Added(e);
 }
        private void Add(Entity entity)
        {
            Assert.False(_entities.Contains(entity) || entity.SystemMask.HasBits(this.SystemBit));

            _entities.Add(entity); // assume that doesn't contain, shouldn't be possible
            entity.AddSystemBit(this.SystemBit);
            this.OnEntityAdded(entity);
        }