Compare commits

...

2 Commits

3 changed files with 30 additions and 4 deletions
+5 -1
View File
@@ -4942,6 +4942,7 @@ MonoBehaviour:
_sandPathBuildService: {fileID: 305503} _sandPathBuildService: {fileID: 305503}
_spawnDeathControl: {fileID: 694046010} _spawnDeathControl: {fileID: 694046010}
_tower: {fileID: 1739395621} _tower: {fileID: 1739395621}
_blockDetector: {fileID: 709556715}
--- !u!1 &645921916 --- !u!1 &645921916
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -13694,6 +13695,10 @@ MonoBehaviour:
_shop: {fileID: 1311268619} _shop: {fileID: 1311268619}
_wallet: {fileID: 1030979928} _wallet: {fileID: 1030979928}
_buttonPrefab: {fileID: 3635012363401127766, guid: f87d5d34136775b41907fc1187ef4bc2, type: 3} _buttonPrefab: {fileID: 3635012363401127766, guid: f87d5d34136775b41907fc1187ef4bc2, type: 3}
_ignoreBlocks:
- {fileID: 1987853413}
- {fileID: 1569763699}
- {fileID: 1331592355}
--- !u!95 &1789632543 --- !u!95 &1789632543
Animator: Animator:
serializedVersion: 7 serializedVersion: 7
@@ -14015,7 +14020,6 @@ MonoBehaviour:
_levels: _levels:
- {fileID: 11400000, guid: db2c2aace91545d4d9deea106eef0f8b, type: 2} - {fileID: 11400000, guid: db2c2aace91545d4d9deea106eef0f8b, type: 2}
- {fileID: 11400000, guid: 16db44f3b18ae8344877ec2245286b7d, type: 2} - {fileID: 11400000, guid: 16db44f3b18ae8344877ec2245286b7d, type: 2}
_pathBuildService: {fileID: 305503}
_onStateChanged: _onStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
+17 -3
View File
@@ -6,6 +6,9 @@ public class Debugger : MonoBehaviour
[SerializeField] private SandPathBuildService _sandPathBuildService; [SerializeField] private SandPathBuildService _sandPathBuildService;
[SerializeField] private SpawnDeathEnemyController _spawnDeathControl; [SerializeField] private SpawnDeathEnemyController _spawnDeathControl;
[SerializeField] private Tower _tower; [SerializeField] private Tower _tower;
[SerializeField] private BlockDetector _blockDetector;
private int _blockCount;
private void OnEnable() private void OnEnable()
{ {
@@ -13,6 +16,7 @@ public class Debugger : MonoBehaviour
_sandPathBuildService.OnBuildComplete += OnBuildComplete; _sandPathBuildService.OnBuildComplete += OnBuildComplete;
_spawnDeathControl.OnLastEnemyDestroyed += OnLastEnemyDestroyed; _spawnDeathControl.OnLastEnemyDestroyed += OnLastEnemyDestroyed;
_tower.OnGameOver += OnGameOver; _tower.OnGameOver += OnGameOver;
_blockDetector.OnBlockClicked += OnBlockClicked;
} }
private void OnDisable() private void OnDisable()
@@ -21,11 +25,15 @@ public class Debugger : MonoBehaviour
_sandPathBuildService.OnBuildComplete -= OnBuildComplete; _sandPathBuildService.OnBuildComplete -= OnBuildComplete;
_spawnDeathControl.OnLastEnemyDestroyed -= OnLastEnemyDestroyed; _spawnDeathControl.OnLastEnemyDestroyed -= OnLastEnemyDestroyed;
_tower.OnGameOver -= OnGameOver; _tower.OnGameOver -= OnGameOver;
_blockDetector.OnBlockClicked -= OnBlockClicked;
} }
private static 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()
@@ -33,13 +41,19 @@ public class Debugger : MonoBehaviour
print("Build complete"); print("Build complete");
} }
private void OnLastEnemyDestroyed() private static void OnLastEnemyDestroyed()
{ {
print("Last enemy destroyed"); print("Last enemy destroyed");
} }
private void OnGameOver() private static void OnGameOver()
{ {
print("Game over"); print("Game over");
} }
private void OnBlockClicked(BlockScript block)
{
if (_gameManager.CurrentState == GameManager.GameState.BuildingPath)
print("Block: " + ++_blockCount + " - " + block);
}
} }
+8
View File
@@ -8,6 +8,7 @@ public class TurretsShopViewer : MonoBehaviour
[SerializeField] private TurretsShop _shop; [SerializeField] private TurretsShop _shop;
[SerializeField] private Wallet _wallet; [SerializeField] private Wallet _wallet;
[SerializeField] private Button _buttonPrefab; [SerializeField] private Button _buttonPrefab;
[SerializeField] private List<BlockScript> _ignoreBlocks;
private Animator _animator; private Animator _animator;
private bool _hidden = true; private bool _hidden = true;
@@ -54,6 +55,13 @@ public class TurretsShopViewer : MonoBehaviour
private void OnBlockSelected(BlockScript block) private void OnBlockSelected(BlockScript block)
{ {
// Чтобы анимация не воспроизводилась когда не надо
if (_ignoreBlocks.Contains(block))
{
_ignoreBlocks.Clear();
return;
}
if (!_hidden) if (!_hidden)
return; return;