public GameEntity ReplaceIdentifiers(Assets.Code.Services.IIdentifierService newValue) { var index = GameComponentsLookup.Identifiers; var component = (Assets.Code.Components.Identifiers)CreateComponent(index, typeof(Assets.Code.Components.Identifiers)); component.Value = newValue; ReplaceComponent(index, component); return(this); }
public GameEntity SetIdentifiers(Assets.Code.Services.IIdentifierService newValue) { if (hasIdentifiers) { throw new Entitas.EntitasException("Could not set Identifiers!\n" + this + " already has an entity with Assets.Code.Components.Identifiers!", "You should check if the context already has a identifiersEntity before setting it or use context.ReplaceIdentifiers()."); } var entity = CreateEntity(); entity.AddIdentifiers(newValue); return(entity); }
public void ReplaceIdentifiers(Assets.Code.Services.IIdentifierService newValue) { var entity = identifiersEntity; if (entity == null) { entity = SetIdentifiers(newValue); } else { entity.ReplaceIdentifiers(newValue); } }