public InputEntity ReplaceInput(Services.IInputService newValue) { var index = InputComponentsLookup.Input; var component = (Components.Input)CreateComponent(index, typeof(Components.Input)); component.Value = newValue; ReplaceComponent(index, component); return(this); }
public InputEntity SetInput(Services.IInputService newValue) { if (hasInput) { throw new Entitas.EntitasException("Could not set Input!\n" + this + " already has an entity with Components.Input!", "You should check if the context already has a inputEntity before setting it or use context.ReplaceInput()."); } var entity = CreateEntity(); entity.AddInput(newValue); return(entity); }
public void ReplaceInput(Services.IInputService newValue) { var entity = inputEntity; if (entity == null) { entity = SetInput(newValue); } else { entity.ReplaceInput(newValue); } }