예제 #1
0
        public override void Update(GameTime gameTime)
        {
            if (turnKeyIsDown)
            {
                keyDownCntr--;

                if (keyDownCntr == 0)
                {
                    sendTargetkey.SendKeyUp((int)Keys.Right);
                    sendTargetkey.SendKeyUp((int)Keys.Left);
                    keyDownCntr   = 5;
                    turnKeyIsDown = false;
                }
            }

            base.Update(gameTime);
        }
예제 #2
0
        //Override this method for the application specific control
        protected override void sendCommand(int output)
        {
            ///Send Key down
            if (!keyIsDown) // if key is up
            {
                switch (output)
                {
                case 0:         //Do Nothing
                    break;

                case 1:         //Up arrow (move forward/up)
                    sendTargetkey.SendKeyDown((int)Keys.Up);
                    keyToPullUp = (int)Keys.Up;
                    keyIsDown   = true;
                    break;

                case 2:         //Down arrow (move backward/down)
                    sendTargetkey.SendKeyDown((int)Keys.Down);
                    keyToPullUp = (int)Keys.Down;
                    keyIsDown   = true;
                    break;

                case 3:         //Right arrow (move right)
                    sendTargetkey.SendKeyDown((int)Keys.Right);
                    keyToPullUp = (int)Keys.Right;
                    keyIsDown   = true;
                    break;

                case 4:         //Left  arrow (move left)
                    sendTargetkey.SendKeyDown((int)Keys.Left);
                    keyToPullUp = (int)Keys.Left;
                    keyIsDown   = true;
                    break;
                }
            }
            else if (keyIsDown)
            {
                keyDownCntr++;
                if (keyDownCntr == 2)
                {
                    keyIsDown = false;
                    sendTargetkey.SendKeyUp(keyToPullUp);
                    keyDownCntr = 0;
                }
            }
            base.sendCommand(output);
        }
예제 #3
0
        //Override this method for the application specific control
        protected override void sendCommand(int output)
        {
            switch (output)
            {
            case 0:         //Do Nothing
                sendTargetkey.SendKeyUp((int)Keys.Down);
                sendTargetkey.SendKeyUp((int)Keys.Right);
                sendTargetkey.SendKeyUp((int)Keys.Left);
                sendTargetkey.SendKeyUp((int)Keys.Up);
                break;

            case 1:         //Up arrow (move forward/up)
                sendTargetkey.SendKeyUp((int)Keys.Down);
                sendTargetkey.SendKeyUp((int)Keys.Right);
                sendTargetkey.SendKeyUp((int)Keys.Left);
                sendTargetkey.SendKeyDown((int)Keys.Up);
                //Console.WriteLine("Up");
                break;

            case 2:         //Down arrow (move backward/down)
                sendTargetkey.SendKeyUp((int)Keys.Up);
                sendTargetkey.SendKeyUp((int)Keys.Right);
                sendTargetkey.SendKeyUp((int)Keys.Left);
                sendTargetkey.SendKeyDown((int)Keys.Down);
                //Console.WriteLine("Down");
                break;

            case 3:         //Right arrow (move right)
                sendTargetkey.SendKeyUp((int)Keys.Down);
                sendTargetkey.SendKeyUp((int)Keys.Up);
                sendTargetkey.SendKeyUp((int)Keys.Left);
                sendTargetkey.SendKeyDown((int)Keys.Right);
                //Console.WriteLine("Right");
                break;

            case 4:         //Left  arrow (move left)
                sendTargetkey.SendKeyUp((int)Keys.Down);
                sendTargetkey.SendKeyUp((int)Keys.Right);
                sendTargetkey.SendKeyUp((int)Keys.Up);
                sendTargetkey.SendKeyDown((int)Keys.Left);
                //Console.WriteLine("Left");
                break;

            default:
                sendTargetkey.SendKeyUp((int)Keys.Down);
                sendTargetkey.SendKeyUp((int)Keys.Right);
                sendTargetkey.SendKeyUp((int)Keys.Left);
                sendTargetkey.SendKeyUp((int)Keys.Up);
                break;
            }
            base.sendCommand(output);
        }