Move Bomb Responsibilities to BombService

This commit is contained in:
2025-12-17 05:47:28 +08:00
parent 9f2ef833b2
commit b3dc2cb4bd
12 changed files with 262 additions and 248 deletions

View File

@@ -2,19 +2,23 @@
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using Models.Interfaces;
using Structs;
using UnityEngine;
namespace Services.Interfaces
{
public interface IBombService
{
IReadOnlyList<Vector2Int> CollectTriggeredBombs(IReadOnlyList<Vector2Int> matchPositions);
public interface IBombService {
public BombSpawnRequest? PendingBombSpawn { get; }
void SetLastSwap(Vector2Int from, Vector2Int to);
void ClearPendingBombs();
void DetectBombSpawnFromLastSwap(List<Gem> currentMatches);
UniTask DetonateChainAsync(
IReadOnlyList<Vector2Int> initialBombs,
Func<Vector2Int, bool> inBounds,
Func<Vector2Int, Gem> getGemAt,
Func<Vector2Int, UniTask> destroyAtAsync,
int radius,
float bombDelaySeconds);
IGameBoard gameBoard);
}
}

View File

@@ -6,10 +6,7 @@ using Structs;
namespace Services.Interfaces {
public interface IMatchService {
List<Gem> CurrentMatches { get; }
IReadOnlyList<BombSpawnRequest> PendingBombSpawns { get; }
bool MatchesAt(Vector2Int positionToCheck, GemType gemTypeToCheck);
void FindAllMatches();
void SetLastSwap(Vector2Int from, Vector2Int to);
void ClearPendingBombs();
}
}