public void WaitingForDiceRoll() { InfoLabel.Text = Game.CurrentPerson.ToString() + " - Roll the dice"; if (Game.CurrentPerson.IsAI) { DiceButton.Enabled = false; DiceTimer.Start(); } else { DiceButton.Enabled = true; } }
}//end UpdatePictureBoxes /// <summary> /// increments counter, show rolling animation while counter is less than 11 /// Stops timer, rolls dice and gets values, enables RollButton. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DiceTimer_Tick(object sender, EventArgs e) { counter++; if (counter < 11) { UpdatePictureBoxes(); } else { DiceTimer.Stop(); RollDice(); RollButton.Enabled = true; } } //end DiceTimer
/// <summary> /// Disables RollButton, initializes counter as 0, starts DiceTimer. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RollButton_Click(object sender, EventArgs e) { RollButton.Enabled = false; counter = 0; DiceTimer.Start(); }//end of RollButton
private void DiceTimer_Tick(object sender, EventArgs e) { DiceTimer.Stop(); Game.Roll(); }