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;
        }
Ejemplo n.º 2
0
        public bool SourceIsSameAsBindingSource(IUniverseCommandSource bindingSource)
        {
            var source = (TestCommandSource)bindingSource;

            return(TestIdentifierThing == source.TestIdentifierThing);
        }
Ejemplo n.º 3
0
        public bool SourceIsSameAsBindingSource(IUniverseCommandSource bindingSource)
        {
            var source = (CommandSource)bindingSource;

            return(ID == source.ID);
        }
Ejemplo n.º 4
0
 public SharperInputComponent(SharperEntity entity, IUniverseCommandSource bindingSource) : base(entity)
 {
     BindingSource = bindingSource;
 }