Cleanup GameBOardService
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Enums;
|
||||
using Models.Interfaces;
|
||||
using Services.Interfaces;
|
||||
@@ -50,6 +51,22 @@ namespace Services {
|
||||
return false;
|
||||
}
|
||||
|
||||
public UniTask<List<Vector2Int>> GetMatchPositionsAsync(List<Vector2Int> protectedPositions) {
|
||||
List<Vector2Int> matchPositions = new List<Vector2Int>(CurrentMatches.Count);
|
||||
for (int i = 0; i < CurrentMatches.Count; i++) {
|
||||
Gem match = CurrentMatches[i];
|
||||
if (match == null) continue;
|
||||
|
||||
Vector2Int pos = match.Position;
|
||||
if (protectedPositions != null && protectedPositions.Contains(pos))
|
||||
continue;
|
||||
|
||||
matchPositions.Add(pos);
|
||||
}
|
||||
|
||||
return UniTask.FromResult(matchPositions);
|
||||
}
|
||||
|
||||
public void FindAllMatches() {
|
||||
this.currentMatches.Clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user