|
@@ -29,7 +29,7 @@ export class SwapTileAction {
|
|
constructor(firstTile, otherTile) {
|
|
constructor(firstTile, otherTile) {
|
|
this.firstTile = firstTile
|
|
this.firstTile = firstTile
|
|
this.otherTile = otherTile
|
|
this.otherTile = otherTile
|
|
- this.tween = []
|
|
|
|
|
|
+ this.tweens = []
|
|
}
|
|
}
|
|
|
|
|
|
execute(isAllowedCallback = () => true) {
|
|
execute(isAllowedCallback = () => true) {
|
|
@@ -41,10 +41,10 @@ export class SwapTileAction {
|
|
this.tweens = [
|
|
this.tweens = [
|
|
AsyncTween.create(this.firstTile.position, this.otherTile.position, 500, Easing.Elastic.EaseOut),
|
|
AsyncTween.create(this.firstTile.position, this.otherTile.position, 500, Easing.Elastic.EaseOut),
|
|
AsyncTween.create(this.otherTile.position, this.firstTile.position, 500, Easing.Elastic.EaseOut)]
|
|
AsyncTween.create(this.otherTile.position, this.firstTile.position, 500, Easing.Elastic.EaseOut)]
|
|
- Promise.all(this.tweens.map((tween) => tween.promise))
|
|
|
|
- .then(() => {
|
|
|
|
- resolve()
|
|
|
|
- })
|
|
|
|
|
|
+ Promise.all(this.tweens.map((tween) => tween.promise)).then(() => {
|
|
|
|
+ resolve()
|
|
|
|
+ this.tweens = []
|
|
|
|
+ })
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -52,7 +52,7 @@ export class SwapTileAction {
|
|
export class MatchTilesAction {
|
|
export class MatchTilesAction {
|
|
constructor(tilesToMatch) {
|
|
constructor(tilesToMatch) {
|
|
this.tilesToMatch = tilesToMatch
|
|
this.tilesToMatch = tilesToMatch
|
|
- this.tween = []
|
|
|
|
|
|
+ this.tweens = []
|
|
}
|
|
}
|
|
|
|
|
|
execute(isAllowedCallback = () => true) {
|
|
execute(isAllowedCallback = () => true) {
|
|
@@ -63,12 +63,12 @@ export class MatchTilesAction {
|
|
}
|
|
}
|
|
this.tweens = []
|
|
this.tweens = []
|
|
this.tilesToMatch.forEach((tile) => {
|
|
this.tilesToMatch.forEach((tile) => {
|
|
- this.tween.push(AsyncTween.create(tile, {scale: 0}, 500, Easing.Quadratic.EaseInOut))
|
|
|
|
|
|
+ this.tweens.push(AsyncTween.create(tile, {scale: 0}, 500, Easing.Quadratic.EaseInOut))
|
|
|
|
+ })
|
|
|
|
+ Promise.all(this.tweens.map((tween) => tween.promise)).then(() => {
|
|
|
|
+ resolve()
|
|
|
|
+ this.tweens = []
|
|
})
|
|
})
|
|
- Promise.all(this.tweens.map((tween) => tween.promise))
|
|
|
|
- .then(() => {
|
|
|
|
- resolve()
|
|
|
|
- })
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|