diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 19587b6..3606970 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -11,7 +11,6 @@ public class GameManager : MonoBehaviour } [SerializeField] private Level[] _levels; - [SerializeField] private SandPathBuildService _pathBuildService; [SerializeField] private UnityEvent _onStateChanged; [SerializeField] private UnityEvent _onLevelChanged; @@ -44,20 +43,6 @@ public class GameManager : MonoBehaviour public int CurrentLevel => _currentLvlIndex + 1; public int TotalLevels => _levels.Length; - private void OnEnable() - { - _pathBuildService.OnBuildComplete += OnBuildComplete; - } - private void OnDisable() - { - _pathBuildService.OnBuildComplete -= OnBuildComplete; - } - - private void OnBuildComplete() - { - CurrentState = GameState.BuildingTurrets; - } - public void NextLevel() { _currentLvlIndex = (_currentLvlIndex + 1) % _levels.Length; diff --git a/Assets/Scripts/SandPathBuildService.cs b/Assets/Scripts/SandPathBuildService.cs index 10c2693..c6b1feb 100644 --- a/Assets/Scripts/SandPathBuildService.cs +++ b/Assets/Scripts/SandPathBuildService.cs @@ -56,7 +56,6 @@ public class SandPathBuildService : MonoBehaviour public void ResetPath() { - // TODO: исправить удаление блоков финала пути for (int i = _predefinedBlocks.Length; i < _blocksInPath.Count; i++) { var block = _blocksInPath[i]; @@ -85,6 +84,7 @@ public class SandPathBuildService : MonoBehaviour _currentBlock = _pathEnd; _blocksInPath.Add(_currentBlock); _onBuildComplete?.Invoke(); + _gameManager.CurrentState = GameManager.GameState.BuildingTurrets; } DestroyBlock(block);