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