Fix enemy spawn position

This commit is contained in:
Andrei Gavra 2019-08-05 21:50:53 +03:00
parent 7297b298f7
commit 7ff62dd5ae
3 changed files with 6 additions and 10 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;
@ -204,13 +208,13 @@ namespace src.Level
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,8 +0,0 @@
fileFormatVersion: 2
guid: f54d1bd14bd3ca042bd867b519fee8cc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

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