Game Development Reference
In-Depth Information
The
Level
class now needs to be modified to introduce this new manager and
get rid of the old list.
// List
<
Enemy
>
_enemyList
¼
new List
<
Enemy
>
();
<
- Removed
EnemyManager _enemyManager;
public Level(Input input, TextureManager textureManager, PersistantGa-
meData gameData)
{
_input
¼
input;
_gameData
¼
gameData;
_textureManager
¼
textureManager;
_background
¼
new ScrollingBackground(textureManager.Get
("background"));
_background.SetScale(2, 2);
_background.Speed
¼
0.15f;
_backgroundLayer
¼
new ScrollingBackground(textureManager.Get
("background_layer_1"));
_backgroundLayer.Speed
¼
0.1f;
_backgroundLayer.SetScale(2.0, 2.0);
_playerCharacter
¼
new PlayerCharacter(_textureManager,
_bulletManager);
_effectsManager
¼
new EffectsManager(_textureManager);
// _enemyList.Add(new Enemy(_textureManager, _effectsManager));
<
- Removed
_enemyManager
¼
new EnemyManager(_textureManager, _effectsMana-
ger, -1300);
}
The collision processing needs to change a little as well; it will now use the list of
enemies in the
EnemyManager
when checking for enemy collisions.
private void UpdateCollisions()
{
foreach (Enemy enemy in _enemyManager.EnemyList)
To be able to see the enemies, the
Update
and
Render
loops need to be
modified.
Search WWH ::
Custom Search