warning when player has been found more than 20 mines
This commit is contained in:
@@ -214,14 +214,18 @@ class GridControl extends React.Component {
|
|||||||
|
|
||||||
/** if you found mine */
|
/** if you found mine */
|
||||||
if (currentObject === 'm') {
|
if (currentObject === 'm') {
|
||||||
this.state.sound.mine.play();
|
|
||||||
|
|
||||||
this.state.foundUserMineCache++;
|
this.state.foundUserMineCache++;
|
||||||
|
|
||||||
if (!justOnFirstIteration) {
|
if (!justOnFirstIteration) {
|
||||||
/** set last clicked field w/ color */
|
/** set last clicked field w/ color */
|
||||||
this.state.lastClicked[activePlayer] = [x, y];
|
this.state.lastClicked[activePlayer] = [x, y];
|
||||||
|
|
||||||
|
this.state.sound[
|
||||||
|
(userControl.refs[activePlayer].state.mines + this.state.foundUserMineCache) > 20
|
||||||
|
? 'warning'
|
||||||
|
: 'mine'
|
||||||
|
].play();
|
||||||
|
|
||||||
if (this.refs.userControl.state.bombSelected) {
|
if (this.refs.userControl.state.bombSelected) {
|
||||||
this.changePlayer(userControl, activePlayer, inactivePlayer);
|
this.changePlayer(userControl, activePlayer, inactivePlayer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user