public RuntimeTerraEntity CreateEntity(ITerraEntityType entityType) { TerraEntity newEntity = new TerraEntity(); AssembledEntity assembled = new AssembledEntity(newEntity); newEntity.EntityID = entityType.EntityID; _db.Write(newEntity, TerraEntity.Serializer, TerraEntity.WherePrimaryKey); RuntimeTerraEntity runtimeTerraEntity = new RuntimeTerraEntity(assembled, _db); return(runtimeTerraEntity); }
public bool RemoveEntity(TerraEntity entity) { if (!_entities.Contains(entity)) { return(false); } else { _entities.Remove(entity); OnRemoveEntity?.Invoke(entity); } return(true); }
public bool AddEntity(TerraEntity entity) { if (_entities.Contains(entity)) { return(false); } else { _entities.Add(entity); OnAddEntity?.Invoke(entity); } return(true); }