private void UseCurrentItem()
        {
            ItemCanShootComponent icsc = (ItemCanShootComponent)this.currentUnit.GetComponent(nameof(ItemCanShootComponent));

            if (icsc != null)
            {
                this.currentInputMode    = InputMode.SelectMapPoint;
                this.currentInputSubMode = InputSubMode.SelectShotTarget;
            }
        }
        public void HandleKeyInput(RLKeyPress keyPress)
        {
            this.doRepaint = true;

            if (this.effectsSystem.HasEffects())
            {
                return;
            }

            switch (keyPress.Key)
            {
            case RLKey.Number1:
            case RLKey.Number2:
            case RLKey.Number3:
            case RLKey.Number4:
            case RLKey.Number5:
            case RLKey.Number6:
            case RLKey.Number7:
            case RLKey.Number8:
            case RLKey.Number9:
                int idx = keyPress.Key - RLKey.Number0;
                if (this.currentInputMode == InputMode.SelectItemFromFloor)
                {
                    if (this.currentInputSubMode == InputSubMode.PickingUpItem)
                    {
                        PositionComponent pos = (PositionComponent)this.currentUnit.GetComponent(nameof(PositionComponent));
                        this.pickupItemSystem.PickupItem(this.currentUnit, this.menuItemList[idx], this.mapData.map[pos.x, pos.y]);
                        this.gameLog.Add("item picked up");
                        this.currentInputMode = InputMode.Normal;
                        this.menuItemList.Clear();
                    }
                }
                else if (this.currentInputMode == InputMode.SelectItemFromInv)
                {
                    if (this.currentInputSubMode == InputSubMode.DroppingItem)
                    {
                        PositionComponent pos = (PositionComponent)this.currentUnit.GetComponent(nameof(PositionComponent));
                        this.pickupItemSystem.DropItem(this.currentUnit, this.menuItemList[idx], this.mapData.map[pos.x, pos.y]);
                        this.gameLog.Add("item dropped up");
                        this.currentInputMode = InputMode.Normal;
                        this.menuItemList.Clear();
                    }
                }
                else if (this.currentInputMode == InputMode.ActivatingCurrentItem)
                {
                    TimerCanBeSetComponent tcbsc = (TimerCanBeSetComponent)this.currentUnit.GetComponent(nameof(TimerCanBeSetComponent));
                    if (tcbsc != null)
                    {
                        if (tcbsc.activated == false)
                        {
                            tcbsc.activated = true;
                            tcbsc.timeLeft  = idx;
                            this.gameLog.Add("Timer set for " + idx);
                        }
                        else
                        {
                            this.gameLog.Add("Timer already set!");
                        }
                    }
                }
                else
                {
                    this.SelectUnit(idx);
                }
                break;

            case RLKey.Up: {
                MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent));
                m.route = null;
                m.offY  = -1;
                break;
            }

            case RLKey.Down: {
                MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent));
                m.route = null;
                m.offY  = 1;
                break;
            }

            case RLKey.Left: {
                MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent));
                m.route = null;
                m.offX  = -1;
                break;
            }

            case RLKey.Right: {
                MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent));
                m.route = null;
                m.offX  = 1;
                break;
            }

            case RLKey.Space: {
                MobDataComponent mdc = (MobDataComponent)this.currentUnit.GetComponent(nameof(MobDataComponent));
                if (mdc.actionPoints > 0)
                {
                    mdc.actionPoints -= 100;
                }
                break;
            }

            case RLKey.A:     // Activate
                this.currentInputMode = InputMode.ActivatingCurrentItem;
                this.gameLog.Add("Enter number from 1-9");
                break;

            case RLKey.D: {     // Drop
                this.currentInputMode    = InputMode.SelectItemFromInv;
                this.currentInputSubMode = InputSubMode.DroppingItem;
                this.ListItemsInInv();
                this.gameLog.Add("Please select an item to drop");
                break;
            }

            case RLKey.P: {     // Pickup
                this.currentInputMode    = InputMode.SelectItemFromFloor;
                this.currentInputSubMode = InputSubMode.PickingUpItem;
                this.ListItemsOnFloor();
                this.gameLog.Add("Please select an item to pick-up");
                break;
            }

            case RLKey.S:     // Stop moving
                var md = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent));
                md.route = null;
                this.gameLog.Add("Movement stopped");
                break;

            case RLKey.T: {     // Throw
                this.currentInputMode    = InputMode.SelectMapPoint;
                this.currentInputSubMode = InputSubMode.ThrowingItem;
                this.gameLog.Add("Select where to throw");
                break;
            }

            case RLKey.U: {     // Use (e.g. shoot)
                this.UseCurrentItem();
                break;
            }

            case RLKey.W: {     // Walk
                this.currentInputMode    = InputMode.SelectMapPoint;
                this.currentInputSubMode = InputSubMode.SelectingDestination;
                this.gameLog.Add("Select where to walk to");
                break;
            }

            case RLKey.X: {     // Test
                BulletEffect  be = new BulletEffect(0, 0, 20, 20);
                EffectsSystem es = (EffectsSystem)this.ecs.GetSystem(nameof(EffectsSystem));
                es.effects.Add(be);
                break;
            }
            }

            //if (action_performed) {
            this.SingleGameLoop();
            //}
            this.checkVisibilitySystem.process(this.playersUnits);
        }