This commit is contained in:
Denis-Cosmin Nutiu 2019-08-08 23:47:30 +03:00
parent c02cbde544
commit f917c78e61

View file

@ -11,9 +11,9 @@ namespace src.Level
{ {
public class LevelManager : GameplayComponent, IDynamicLevelData public class LevelManager : GameplayComponent, IDynamicLevelData
{ {
/** Extracted them here for easy to change reason */ /** Safe-zone coordinates to prevent enemies to instantly kill you*/
private const int XMaxEnemyPosition = 5; private const int XMaxEnemyPosition = 4;
private const int YMinEnemyPosition = -5; private const int YMinEnemyPosition = -4;
public Count DestructibleWallCount public Count DestructibleWallCount
{ {
@ -205,8 +205,8 @@ namespace src.Level
private void SetupLevelEnemies() private void SetupLevelEnemies()
{ {
var numberOfEnemiesToPlace = _enemyCount.RandomIntRange(); var numberOfEnemiesToPlace = _enemyCount.RandomIntRange();
_freeGridPositions.ShuffleList();
_freeGridPositions.RemoveAll(pos => pos.x <= XMaxEnemyPosition && pos.y >= YMinEnemyPosition); _freeGridPositions.RemoveAll(pos => pos.x <= XMaxEnemyPosition && pos.y >= YMinEnemyPosition);
_freeGridPositions.ShuffleList();
foreach (var nextPosition in _freeGridPositions) foreach (var nextPosition in _freeGridPositions)
{ {
if (numberOfEnemiesToPlace == 0) if (numberOfEnemiesToPlace == 0)