public Entity Create() { Entity e = removedAndAvailable.RemoveLast(); if (e == null) { e = new Entity(world, nextAvailableId++); } else { e.Reset(); } e.SetUniqueId(uniqueEntityId++); activeEntities.Set(e.GetId(), e); count++; totalCreated++; if (AddedEntityEvent != null) { AddedEntityEvent(e); } return(e); }
/// <summary> /// Create a new, "blank" entity /// </summary> /// <returns>New entity</returns> public Entity Create() { Entity e = removedAndAvailable.RemoveLast(); if (e == null) { e = new Entity(world, nextAvailableId++); } else { e.Reset(); } e.UniqueId = BitConverter.ToInt64(Guid.NewGuid().ToByteArray(), 0); activeEntities.Set(e.Id, e); count++; totalCreated++; if (AddedEntityEvent != null) { AddedEntityEvent(e); } return(e); }