mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 01:56:57 +00:00
Небольшие исправления
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user