Removed debuging comments

Fixed the behavior of WaveObserver when a monster dies
This commit is contained in:
Ader Alisma 01 2023-08-06 18:51:27 -04:00
parent a0aa9cfb64
commit fcc29ad88a
3 changed files with 7 additions and 5 deletions

View File

@ -40,7 +40,6 @@ public class WaveObserver : Singleton<WaveObserver>
if(_levelConfig.ConstantSpawn[i].GetEnemyObject() == paramPrefab)
{
currentCount = _copyConstantSpawn[i]--;
Debug.Log("nbr " + currentCount);
break;
}
}
@ -68,7 +67,6 @@ public class WaveObserver : Singleton<WaveObserver>
{
_subjects[i].StopSpawn();
}
Debug.Log("Made in: " + i + ". In count of : " + _aliveEnemyCount[i]);
return i;
}
}
@ -82,6 +80,5 @@ public class WaveObserver : Singleton<WaveObserver>
_subjects[position].StartSpawn();
}
_aliveEnemyCount[position]--;
Debug.Log("RIP");
}
}

View File

@ -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<Rigidbody2D>();
Animation = gameObject.AddComponent<AnimationEntity>();
_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);
}
}

View File

@ -66,7 +66,6 @@ public class SpawnerTile : LevelTile
internal void StopSpawn()
{
stopped = true;
Debug.Log("I STOPPED, GAWSH!!!");
}
internal void StartSpawn()