public void ReplaceGameInputButton(Game.InputButton newInputButton, Game.InputState newInputState) { var index = InputComponentsLookup.GameInputButton; var component = (Game.InputButtonComponent)CreateComponent(index, typeof(Game.InputButtonComponent)); component.InputButton = newInputButton; component.InputState = newInputState; ReplaceComponent(index, component); }
public InputEntity SetGameInputButton(Game.InputButton newInputButton, Game.InputState newInputState) { if (hasGameInputButton) { throw new Entitas.EntitasException("Could not set GameInputButton!\n" + this + " already has an entity with Game.InputButtonComponent!", "You should check if the context already has a gameInputButtonEntity before setting it or use context.ReplaceGameInputButton()."); } var entity = CreateEntity(); entity.AddGameInputButton(newInputButton, newInputState); return(entity); }
public void ReplaceGameInputButton(Game.InputButton newInputButton, Game.InputState newInputState) { var entity = gameInputButtonEntity; if (entity == null) { entity = SetGameInputButton(newInputButton, newInputState); } else { entity.ReplaceGameInputButton(newInputButton, newInputState); } }