Esempio n. 1
0
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            ActionParams ap = new ActionParams();

            ap.A = e.KeyData == Keys.A;
            ap.D = e.KeyData == Keys.D;
            ap.L = e.KeyData == Keys.L;
            ap.J = e.KeyData == Keys.J;
            ap.N = e.KeyData == Keys.N;
        }
Esempio n. 2
0
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            ActionParams ap = new ActionParams();

            ap.A = e.KeyChar == 'a';
            ap.D = e.KeyChar == 'd';
            ap.J = e.KeyChar == 'j';
            ap.L = e.KeyChar == 'l';
            ap.N = e.KeyChar == 'n';

            string key = e.KeyChar.ToString();
            GameClient.Client(key);
        }
Esempio n. 3
0
        public static void Server()
        {
            TcpListener listener = new TcpListener(IPAddress.Any, 51111);
            listener.Start();

            using (TcpClient c = listener.AcceptTcpClient())
            using (NetworkStream n = c.GetStream())
            {
                string msg = new BinaryReader(n).ReadString();

                if (msg == "a" || msg == "A")
                {
                    ActionParams ap = new ActionParams();

                    ap.A = true;
                    ap.D = false;
                    ap.J = false;
                    ap.L = false;
                    ap.N = false;

                    GameController.KeyDown(ap);
                }
                else if (msg == "d" || msg == "D")
                {
                    ActionParams ap = new ActionParams();

                    ap.A = false;
                    ap.D = true;
                    ap.J = false;
                    ap.L = false;
                    ap.N = false;

                    GameController.KeyDown(ap);
                }
            }
            listener.Stop();
        }
Esempio n. 4
0
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            ActionParams ap = new ActionParams();

            ap.A = e.KeyChar == 'a';
            ap.D = e.KeyChar == 'd';
            ap.J = e.KeyChar == 'j';
            ap.L = e.KeyChar == 'l';
            ap.N = e.KeyChar == 'n';

            gameArea.KeyDown(ap);
        }
Esempio n. 5
0
 public void KeyUp(ActionParams actions)
 {
     int count = gameObjects.Count;
     for (int i = 0; i < count; ++i)
     {
         if (gameObjects[i] is PlayerVehicle)
         {
             (gameObjects[i] as PlayerVehicle).KeyUp(actions);
         }
     }
 }
Esempio n. 6
0
        public void KeyUp(ActionParams actions)
        {
            if (actions.A)
            {
                left = false;
            }
            if (actions.D)
            {
                right = false;
            }
            if (actions.L)
            {
                driveForward = false;
            }

            if (actions.J)
            {
                driveBackward = false;
            }

            if (actions.N)
            {
                shoot = false;
            }
        }
Esempio n. 7
0
        public void KeyDown(ActionParams actions)
        {
            if (actions.A)
            {
                left = true;
            }
            if (actions.D)
            {
                right = true;
            }
            if (actions.L)
            {
                driveForward = true;
            }

            if (actions.J)
            {
                driveBackward = true;
            }

            if (actions.N)
            {
                shoot = true;
            }
        }