Optimization and Documentation
This commit is contained in:
@@ -10,14 +10,51 @@ using UnityEngine;
|
||||
namespace Services.Interfaces
|
||||
{
|
||||
public interface IBombService {
|
||||
public BombSpawnRequest? PendingBombSpawn { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Caches last swap action.
|
||||
/// </summary>
|
||||
/// <param name="from">
|
||||
/// Original location of the gem.
|
||||
/// </param>
|
||||
/// <param name="to">
|
||||
/// Destination location of the gem.
|
||||
/// </param>
|
||||
void SetLastSwap(Vector2Int from, Vector2Int to);
|
||||
|
||||
/// <summary>
|
||||
/// Try to spawn a bomb at the last swap location.
|
||||
/// </summary>
|
||||
/// <param name="currentMatches">
|
||||
/// List of current matches.
|
||||
/// </param>
|
||||
void DetectBombSpawnFromLastSwap(HashSet<Gem> currentMatches);
|
||||
List<Vector2Int> ApplyPendingBombSpawns(Action<Vector2Int, GemType, bool> spawnGem);
|
||||
UniTask<List<Vector2Int>> GetInitialBombs(List<Vector2Int> protectedPositions, List<Vector2Int> bombCandidates);
|
||||
|
||||
/// <summary>
|
||||
/// Get a List of bombs that we will detonate.
|
||||
/// </summary>
|
||||
/// <param name="protectedPositions">
|
||||
/// Protected positions, bombs that we don't want to destroy.
|
||||
/// </param>
|
||||
/// <param name="bombCandidates">
|
||||
/// Possible bombs.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
UniTask<List<Vector2Int>> GetInitialBombs(List<Vector2Int> protectedPositions, HashSet<Vector2Int> bombCandidates);
|
||||
|
||||
/// <summary>
|
||||
/// Detonate the bomb(s) part of the match. If there are other bombs within the radius, they will be detonated too sequentially.
|
||||
/// </summary>
|
||||
/// <param name="initialBombs">
|
||||
/// List of bombs to detonate.
|
||||
/// </param>
|
||||
/// <param name="destroyAtAsync">
|
||||
/// Destroy function reference.
|
||||
/// </param>
|
||||
/// <param name="gameBoard">
|
||||
/// Gameboard reference.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
UniTask DetonateChainAsync(
|
||||
IReadOnlyList<Vector2Int> initialBombs,
|
||||
Func<Vector2Int, UniTask> destroyAtAsync,
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace Services.Interfaces {
|
||||
void Setup();
|
||||
|
||||
UniTask<bool> TrySwap(Vector2Int from, Vector2Int to);
|
||||
UniTask<bool> TrySwitch(Vector2Int position);
|
||||
void TrySwitch(Vector2Int position);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,25 @@ using Structs;
|
||||
namespace Services.Interfaces {
|
||||
public interface IMatchService {
|
||||
HashSet<Gem> CurrentMatches { get; }
|
||||
UniTask<List<Vector2Int>> GetMatchPositionsAsync(List<Vector2Int> protectedPositions);
|
||||
/// <summary>
|
||||
/// Get positions of all matches that are not protected.
|
||||
/// </summary>
|
||||
/// <param name="protectedPositions">
|
||||
/// Protected positions, bombs that we don't want to destroy.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
UniTask<HashSet<Vector2Int>> GetMatchPositionsAsync(List<Vector2Int> protectedPositions);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if there are any matches at the given position and type.
|
||||
/// </summary>
|
||||
/// <param name="positionToCheck">
|
||||
/// Position on the gameBoard to check.
|
||||
/// </param>
|
||||
/// <param name="gemTypeToCheck">
|
||||
/// Type of gem to check.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
bool MatchesAt(Vector2Int positionToCheck, GemType gemTypeToCheck);
|
||||
void FindAllMatches();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Services.Interfaces {
|
||||
public interface IScoreService {
|
||||
event Action<int> OnScoreChanged;
|
||||
int Score { get; }
|
||||
void ScoreCheck(int value);
|
||||
void AddScore(int value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user