mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 01:56:57 +00:00
Изменил переключение GameState, когда путь построен
This commit is contained in:
@@ -11,7 +11,6 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
|
||||
[SerializeField] private Level[] _levels;
|
||||
[SerializeField] private SandPathBuildService _pathBuildService;
|
||||
[SerializeField] private UnityEvent<GameState> _onStateChanged;
|
||||
[SerializeField] private UnityEvent<OnLevelChangedEventArgs> _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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user