private void Form1_KeyDown(object sender, KeyEventArgs e) { if (onlinehost == true || online == false) { //Czołg 1 if (e.KeyCode == Keys.Up) { tank1.keyTank[KUp] = true; } if (e.KeyCode == Keys.Right) { tank1.keyTank[KRight] = true; } if (e.KeyCode == Keys.Down) { tank1.keyTank[KDown] = true; } if (e.KeyCode == Keys.Left) { tank1.keyTank[KLeft] = true; } } //Czołg 2 if (onlinehost == false || online == false) { if (e.KeyCode == Keys.W) { tank2.keyTank[KUp] = true; } if (e.KeyCode == Keys.D) { tank2.keyTank[KRight] = true; } if (e.KeyCode == Keys.S) { tank2.keyTank[KDown] = true; } if (e.KeyCode == Keys.A) { tank2.keyTank[KLeft] = true; } } if (e.KeyCode == Keys.Escape) { disconect = true; if (online) { SocketConnect.SendTimer(); online = false; } Application.Restart(); } }
private void timerSend_Tick(object sender, EventArgs e) { if (timersOff == true) { timersOff = false; timerHost.Enabled = false; timerSend.Enabled = false; tank1timer.Enabled = false; tank2timer.Enabled = false; bulletTimer.Enabled = false; } SocketConnect.SendTimer(); }