using System.Collections.Generic; using UnityEngine; public class EndGameHandler : MonoBehaviour { public void HandleEndGame(Team lastPlayer, GameMode gameMode, CheckResult lastResult) { print("Конец игры"); if (lastResult.Draw) DrawHandler(); else WinHandler(winner: lastPlayer, gameMode: gameMode, winChipsCoords: lastResult.WinningIndexes); } private void DrawHandler() { print("Это ничья"); } private void WinHandler(Team winner, GameMode gameMode, HashSet<(int row, int col)> winChipsCoords) { Debug.Log($"Победа {winner}; Режим {gameMode}"); PlayWinChipsAnimation(winChipsCoords); } private void PlayWinChipsAnimation(HashSet<(int row, int col)> winChipsCoords) { Chip[,] grid = Board.Instance.Grid; foreach (var winCoord in winChipsCoords) grid[winCoord.col, winCoord.row].WinAnimation(); } }