public void ReplaceInputController(svanderweele.Core.Pieces.Input.Controller.IInputController newInstance) { var index = MetaComponentsLookup.InputController; var component = CreateComponent <svanderweele.Core.Pieces.Input.Controller.InputControllerComponent>(index); component.instance = newInstance; ReplaceComponent(index, component); }
public MetaEntity SetInputController(svanderweele.Core.Pieces.Input.Controller.IInputController newInstance) { if (hasInputController) { throw new Entitas.EntitasException("Could not set InputController!\n" + this + " already has an entity with svanderweele.Core.Pieces.Input.Controller.InputControllerComponent!", "You should check if the context already has a inputControllerEntity before setting it or use context.ReplaceInputController()."); } var entity = CreateEntity(); entity.AddInputController(newInstance); return(entity); }
public void ReplaceInputController(svanderweele.Core.Pieces.Input.Controller.IInputController newInstance) { var entity = inputControllerEntity; if (entity == null) { entity = SetInputController(newInstance); } else { entity.ReplaceInputController(newInstance); } }