Fix enemy spawn position
This commit is contained in:
parent
7297b298f7
commit
7ff62dd5ae
3 changed files with 6 additions and 10 deletions
|
@ -12,6 +12,10 @@ namespace src.Level
|
||||||
{
|
{
|
||||||
public class LevelManager : GameplayComponent, IDynamicLevelData
|
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
|
public Count DestructibleWallCount
|
||||||
{
|
{
|
||||||
get => _destructibleWallCount;
|
get => _destructibleWallCount;
|
||||||
|
@ -204,13 +208,13 @@ namespace src.Level
|
||||||
var numberOfEnemiesToPlace = _enemyCount.RandomIntRange();
|
var numberOfEnemiesToPlace = _enemyCount.RandomIntRange();
|
||||||
|
|
||||||
_freeGridPositions.ShuffleList();
|
_freeGridPositions.ShuffleList();
|
||||||
|
_freeGridPositions.RemoveAll(pos => pos.x <= XMaxEnemyPosition && pos.y >= YMinEnemyPosition);
|
||||||
foreach (var nextPosition in _freeGridPositions)
|
foreach (var nextPosition in _freeGridPositions)
|
||||||
{
|
{
|
||||||
if (numberOfEnemiesToPlace == 0)
|
if (numberOfEnemiesToPlace == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaceEnemy(nextPosition);
|
PlaceEnemy(nextPosition);
|
||||||
numberOfEnemiesToPlace -= 1;
|
numberOfEnemiesToPlace -= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: f54d1bd14bd3ca042bd867b519fee8cc
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1 +1 @@
|
||||||
m_EditorVersion: 2018.4.3f1
|
m_EditorVersion: 2018.4.5f1
|
||||||
|
|
Loading…
Reference in a new issue