private void Gh_EClickedButton(object sender, ButtonClickEvent e) { CoolDownTimer.Start(); panelBoard.Enabled = false; pbCoolDown.Value = 0; socket.Send(new SocketData((int)SocketCommand.SEND_POINT, "", e.ClickedPoint)); isPlaying = false; Listen(); }
public void FireLaser() { if (laserCooldown.IsOnCooldown() == false) { laserCooldown.Start(); GameObject laser = Instantiate(bullet) as GameObject; laser.transform.position = barrel.transform.position; laser.GetComponent <LaserMovement>().MoveDirection = GetFireDirection(); } }
/// <summary> /// Xử lý gói dữ liệu dạng SocketData /// </summary> /// <param name="data"></param> private void DataHandling(SocketData data) { switch (data.Command) { case (int)SocketCommand.NOTIFY: break; case (int)SocketCommand.NEW_GAME: this.Invoke((MethodInvoker)(() => { NewGame(); panelBoard.Enabled = false; CoolDownTimer.Stop(); })); break; case (int)SocketCommand.SEND_POINT: this.Invoke((MethodInvoker)(() => { pbCoolDown.Value = 0; panelBoard.Enabled = true; CoolDownTimer.Start(); gh.OtherPlayerMark(data.Point); })); break; //case (int)SocketCommand.END_GAME: // MessageBox.Show("Bạn đã thua"); // break; case (int)SocketCommand.TIME_OUT: EndGame(); MessageBox.Show("Bạn đã thắng!"); break; case (int)SocketCommand.QUIT: CoolDownTimer.Stop(); MessageBox.Show("Đối thủ đã thoát ra!"); break; default: break; } Listen(); }