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);
        }
Esempio n. 3
0
        public bool SourceIsSameAsBindingSource(IUniverseCommandSource bindingSource)
        {
            var source = (CommandSource)bindingSource;

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