public void DespawnAll() { for (var i = _activeEntities.Count - 1; i >= 0; i--) { _cachedEntity = _activeEntities[i]; if (_cachedEntity.Type == typeof(Player)) { continue; } Despawn(_cachedEntity); } CustomDebug.Assert(_activeEntities.Count(e => e.Type == typeof(Enemy)) == 0); CustomDebug.Assert(_activeEntities.Count(e => e.Type == typeof(Projectile)) == 0); CustomDebug.Assert(_activeEntities.Count(e => e.Type == typeof(Player)) == 1); }
protected void OnCollisionEnter2D(Collision2D other) { CustomDebug.Assert(null != _events, "Events not initilized in scene entity"); _events.EntityCollided.Invoke(Id); }