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()