Private
Public Access
1
0

warning when player has been found more than 20 mines

This commit is contained in:
2016-10-31 18:37:14 +01:00
parent 0246991be9
commit 418f8f3b67

View File

@@ -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);
} }