public async Task AssignNewCommandAsync(IUniverseCommandInfo commandInfo, IUniverseCommandSource bindingSource) { var inputComponent = Components.FirstOrDefault(x => x.BindingSource.SourceIsSameAsBindingSource(bindingSource)); if (inputComponent == null) { var newEntity = await Game.CreateEntityAsync(); NewInputEntityCreated?.Invoke(this, new SharperEntityEventArgs(newEntity)); await RegisterComponentAsync(newEntity, bindingSource); inputComponent = Components.First(x => x.BindingSource.SourceIsSameAsBindingSource(bindingSource)); } inputComponent.CurrentCommand = commandInfo; }
public bool SourceIsSameAsBindingSource(IUniverseCommandSource bindingSource) { var source = (TestCommandSource)bindingSource; return(TestIdentifierThing == source.TestIdentifierThing); }
public bool SourceIsSameAsBindingSource(IUniverseCommandSource bindingSource) { var source = (CommandSource)bindingSource; return(ID == source.ID); }
public SharperInputComponent(SharperEntity entity, IUniverseCommandSource bindingSource) : base(entity) { BindingSource = bindingSource; }