From fcc29ad88a2281c54f778e366322a25db4a51b29 Mon Sep 17 00:00:00 2001 From: Ader Alisma 01 Date: Sun, 6 Aug 2023 18:51:27 -0400 Subject: [PATCH] Removed debuging comments Fixed the behavior of WaveObserver when a monster dies --- Assets/Scripts/LevelConfig/WaveObserver.cs | 3 --- Assets/Scripts/Opponent/Opponent.cs | 8 +++++++- Assets/Scripts/Tiles/SpawnerTile.cs | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/LevelConfig/WaveObserver.cs b/Assets/Scripts/LevelConfig/WaveObserver.cs index 060d5cf..fced3ae 100644 --- a/Assets/Scripts/LevelConfig/WaveObserver.cs +++ b/Assets/Scripts/LevelConfig/WaveObserver.cs @@ -40,7 +40,6 @@ public class WaveObserver : Singleton if(_levelConfig.ConstantSpawn[i].GetEnemyObject() == paramPrefab) { currentCount = _copyConstantSpawn[i]--; - Debug.Log("nbr " + currentCount); break; } } @@ -68,7 +67,6 @@ public class WaveObserver : Singleton { _subjects[i].StopSpawn(); } - Debug.Log("Made in: " + i + ". In count of : " + _aliveEnemyCount[i]); return i; } } @@ -82,6 +80,5 @@ public class WaveObserver : Singleton _subjects[position].StartSpawn(); } _aliveEnemyCount[position]--; - Debug.Log("RIP"); } } diff --git a/Assets/Scripts/Opponent/Opponent.cs b/Assets/Scripts/Opponent/Opponent.cs index 4e2dd35..25de0fd 100644 --- a/Assets/Scripts/Opponent/Opponent.cs +++ b/Assets/Scripts/Opponent/Opponent.cs @@ -8,6 +8,7 @@ public class Opponent : Entity private Vector2 _movementVector = Vector2.zero; private Rigidbody2D _rigidbody; private WaveObserver _observer; + private int _index; public override void Start() { @@ -16,7 +17,7 @@ public class Opponent : Entity _rigidbody = GetComponent(); Animation = gameObject.AddComponent(); _observer = WaveObserver.Instance; - _observer.NotifyEnemy(transform.position.y); + _index = _observer.NotifyEnemy(transform.position.y); } void Update() @@ -49,4 +50,9 @@ public class Opponent : Entity AttackSpeedWait += Time.deltaTime; } + private void OnDisable() + { + _observer.NotifyDies(_index); + } + } diff --git a/Assets/Scripts/Tiles/SpawnerTile.cs b/Assets/Scripts/Tiles/SpawnerTile.cs index 3cd94d4..e12f99c 100644 --- a/Assets/Scripts/Tiles/SpawnerTile.cs +++ b/Assets/Scripts/Tiles/SpawnerTile.cs @@ -66,7 +66,6 @@ public class SpawnerTile : LevelTile internal void StopSpawn() { stopped = true; - Debug.Log("I STOPPED, GAWSH!!!"); } internal void StartSpawn()