private void RobotTurn(ref bool MyTurn) { if (MyTurn == false) { Random random = new Random(); labelWhosTurn.Text = "ХОД РОБОТА"; labelWhosTurn.ForeColor = Color.Red; Cursor = Cursors.WaitCursor; TurnTimer.Interval = random.Next(5000, 7000); TurnTimer.Start(); } }
protected virtual bool BeginTurn(Direction newDirection) { if (m_TurnTimer != null) { m_TurnTimer.Stop(); } m_TurnTimer = new TurnTimer(this, newDirection); m_TurnTimer.Start(); return(true); }
protected virtual bool BeginTurn(Direction newDirection) { if (_currentTurnTimer != null) { _currentTurnTimer.Stop(); } _currentTurnTimer = new TurnTimer(this, newDirection); _currentTurnTimer.Start(); return(true); }
public void StartPexeso(int row, int columns) { CreateCardsForGame(row, columns); Score = 0; RoundTimer.Start(); ChoseSecondCardTimer.Start(); TurnTimer.Start(); RoundStopWatch.Start(); TurnStopWatch.Start(); //ChoseSecondCardStopwatch.Start(); }
} // Timerları yavaşlatma işlemini gerçekleştiren buton private void turnTimerControl_Click(object sender, EventArgs e) { if (btnPlayStop.AccessibleName == "1") { TurnTimer.Stop(); btnPlayStop.AccessibleName = "2"; btnPlayStop.Image = Properties.Resources.playButton; } else { TurnTimer.Start(); btnPlayStop.AccessibleName = "1"; btnPlayStop.Image = Properties.Resources.pauseButton; } } // Timerları durdurup , başlatma işlemini gerçekleştiren buton
// loop thread: runs processes that can't be event driven private void UpdateLoop() { TurnTimer.Start(); while (Running) { if (TurnTimer.ElapsedMilliseconds > TurnTimeLimit) { foreach (Player player in controllers.Player.GetAllPlayers()) { player.EndedTurn = true; } EndTurn(TurnEndReason.TimeOut); TurnTimer.Restart(); } } }