Adjust Bomb Behavior
This commit is contained in:
@@ -193,15 +193,6 @@ namespace Services {
|
||||
matchPositions.Add(pos);
|
||||
}
|
||||
|
||||
foreach (Vector2Int pos in matchPositions.Distinct().ToList()) {
|
||||
Gem gem = GetGem(pos);
|
||||
if (gem == null) continue;
|
||||
if (gem.Type == GemType.Bomb) continue;
|
||||
|
||||
this.scoreService.ScoreCheck(gem.ScoreValue);
|
||||
DestroyMatchedGems(pos);
|
||||
}
|
||||
|
||||
IReadOnlyList<Vector2Int> bombCandidates = this.bombService.CollectTriggeredBombs(matchPositions);
|
||||
|
||||
List<Vector2Int> initialBombs = new List<Vector2Int>();
|
||||
@@ -217,7 +208,40 @@ namespace Services {
|
||||
}
|
||||
initialBombs = initialBombs.Distinct().ToList();
|
||||
|
||||
await this.bombService.DetonateChainAsync(initialBombs, InBounds, GetGem, DestroyAtAsync, this.gameVariables.bombRadius, this.gameVariables.bombDelay, this.gameVariables.bombSelfDelay);
|
||||
// If a bomb is part of the match, do NOT destroy matching pieces immediately.
|
||||
// Let the bomb's manhattan-distance explosion destroy them in sequence.
|
||||
if (initialBombs.Count > 0) {
|
||||
await this.bombService.DetonateChainAsync(
|
||||
initialBombs,
|
||||
InBounds,
|
||||
GetGem,
|
||||
DestroyAtAsync,
|
||||
this.gameVariables.bombRadius,
|
||||
this.gameVariables.bombDelay,
|
||||
this.gameVariables.bombSelfDelay);
|
||||
|
||||
await MoveGemsDown();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Vector2Int pos in matchPositions.Distinct().ToList()) {
|
||||
Gem gem = GetGem(pos);
|
||||
if (gem == null) continue;
|
||||
if (gem.Type == GemType.Bomb) continue;
|
||||
|
||||
this.scoreService.ScoreCheck(gem.ScoreValue);
|
||||
DestroyMatchedGems(pos);
|
||||
}
|
||||
|
||||
await this.bombService.DetonateChainAsync(
|
||||
initialBombs,
|
||||
InBounds,
|
||||
GetGem,
|
||||
DestroyAtAsync,
|
||||
this.gameVariables.bombRadius,
|
||||
this.gameVariables.bombDelay,
|
||||
this.gameVariables.bombSelfDelay);
|
||||
|
||||
await MoveGemsDown();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user