Merge pull request #65 from dnutiu/fix-enemy-spawn

Fix enemy spawn position
This commit is contained in:
Juravski 2019-08-06 20:06:16 +03:00 committed by GitHub
commit eaed21b897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -12,6 +12,10 @@ namespace src.Level
{
public class LevelManager : GameplayComponent, IDynamicLevelData
{
/** Extracted them here for easy to change reason */
private const int XMaxEnemyPosition = 5;
private const int YMinEnemyPosition = -5;
public Count DestructibleWallCount
{
get => _destructibleWallCount;
@ -202,15 +206,14 @@ namespace src.Level
private void SetupLevelEnemies()
{
var numberOfEnemiesToPlace = _enemyCount.RandomIntRange();
_freeGridPositions.ShuffleList();
_freeGridPositions.RemoveAll(pos => pos.x <= XMaxEnemyPosition && pos.y >= YMinEnemyPosition);
foreach (var nextPosition in _freeGridPositions)
{
if (numberOfEnemiesToPlace == 0)
{
break;
}
PlaceEnemy(nextPosition);
numberOfEnemiesToPlace -= 1;
}

View file

@ -1 +1 @@
m_EditorVersion: 2018.4.3f1
m_EditorVersion: 2018.4.5f1