on click opponents bomb, you cannot target && refactor
This commit is contained in:
@@ -352,11 +352,17 @@ class GridControl extends React.Component {
|
|||||||
*/
|
*/
|
||||||
onHoverWithBomb(coords) {
|
onHoverWithBomb(coords) {
|
||||||
if (this.refs.userControl.state.bombSelected) {
|
if (this.refs.userControl.state.bombSelected) {
|
||||||
/** clear cache, reset symbols */
|
var activePlayer = this.refs.userControl.state.activePlayer ? 'blue' : 'red';
|
||||||
this.bombClear();
|
|
||||||
|
|
||||||
/** new cache && field activate */
|
if (activePlayer === this.state.webPlayer) {
|
||||||
this.bombCreate(coords[0], coords[1]);
|
/** clear cache, reset symbols */
|
||||||
|
this.bombClear();
|
||||||
|
|
||||||
|
/** new cache && field activate */
|
||||||
|
this.bombCreate(coords[0], coords[1]);
|
||||||
|
} else {
|
||||||
|
this.refs.userControl.setState({bombSelected: false});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ class GridField extends React.Component {
|
|||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
var wave = Math.floor(Math.random() * 3) + 1;
|
var wave = Math.floor(Math.random() * 3) + 1;
|
||||||
|
|
||||||
console.log('mounted');
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
currentImage: this.state.icons.root + this.state.icons.water[wave]
|
currentImage: this.state.icons.root + this.state.icons.water[wave]
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user