Adjust Bomb Behavior

This commit is contained in:
2025-12-16 21:19:33 +08:00
parent d10d574cff
commit 9842e7ef3f
4 changed files with 45 additions and 27 deletions

View File

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