Небольшие исправления

This commit is contained in:
2026-05-29 18:12:04 +03:00
parent 9405cb7328
commit 2a3e3417d4
2 changed files with 4 additions and 26 deletions
-22
View File
@@ -5,18 +5,12 @@ public class Debugger : MonoBehaviour
[SerializeField] private GameManager _gameManager; [SerializeField] private GameManager _gameManager;
[SerializeField] private SandPathBuildService _sandPathBuildService; [SerializeField] private SandPathBuildService _sandPathBuildService;
[SerializeField] private SpawnDeathEnemyController _spawnDeathControl; [SerializeField] private SpawnDeathEnemyController _spawnDeathControl;
[SerializeField] private Tower _tower;
[SerializeField] private BlockDetector _blockDetector;
private int _blockCount;
private void OnEnable() private void OnEnable()
{ {
_gameManager.OnStateChanged += OnGameStateChanged; _gameManager.OnStateChanged += OnGameStateChanged;
_sandPathBuildService.OnBuildComplete += OnBuildComplete; _sandPathBuildService.OnBuildComplete += OnBuildComplete;
_spawnDeathControl.OnLastEnemyDestroyed += OnLastEnemyDestroyed; _spawnDeathControl.OnLastEnemyDestroyed += OnLastEnemyDestroyed;
_tower.OnGameOver += OnGameOver;
_blockDetector.OnBlockClicked += OnBlockClicked;
} }
private void OnDisable() private void OnDisable()
@@ -24,16 +18,11 @@ public class Debugger : MonoBehaviour
_gameManager.OnStateChanged -= OnGameStateChanged; _gameManager.OnStateChanged -= OnGameStateChanged;
_sandPathBuildService.OnBuildComplete -= OnBuildComplete; _sandPathBuildService.OnBuildComplete -= OnBuildComplete;
_spawnDeathControl.OnLastEnemyDestroyed -= OnLastEnemyDestroyed; _spawnDeathControl.OnLastEnemyDestroyed -= OnLastEnemyDestroyed;
_tower.OnGameOver -= OnGameOver;
_blockDetector.OnBlockClicked -= OnBlockClicked;
} }
private void OnGameStateChanged(GameManager.GameState newState) private void OnGameStateChanged(GameManager.GameState newState)
{ {
print("State changed, current state: " + newState); print("State changed, current state: " + newState);
if (newState == GameManager.GameState.BuildingTurrets)
print("Total blocks in path: " + _blockCount);
} }
private static void OnBuildComplete() private static void OnBuildComplete()
@@ -45,15 +34,4 @@ public class Debugger : MonoBehaviour
{ {
print("Last enemy destroyed"); print("Last enemy destroyed");
} }
private static void OnGameOver()
{
print("Game over");
}
private void OnBlockClicked(BlockScript block)
{
if (_gameManager.CurrentState == GameManager.GameState.BuildingPath)
print("Block: " + ++_blockCount + " - " + block);
}
} }
+4 -4
View File
@@ -55,16 +55,16 @@ public class TurretsShopViewer : MonoBehaviour
private void OnBlockSelected(BlockScript block) private void OnBlockSelected(BlockScript block)
{ {
if (!_hidden)
return;
// Чтобы анимация не воспроизводилась когда не надо // Чтобы анимация не воспроизводилась когда не надо
if (_ignoreBlocks.Contains(block)) if (_ignoreBlocks.Count > 0 && _ignoreBlocks.Contains(block))
{ {
_ignoreBlocks.Clear(); _ignoreBlocks.Clear();
return; return;
} }
if (!_hidden)
return;
_animator.CrossFade(_showAnimation, 0.1f); _animator.CrossFade(_showAnimation, 0.1f);
_hidden = false; _hidden = false;
} }