public void SpawnEnemie() { enemieNumber = 10; while (enemieNumber > 0) { for (int i = 200; i < TileMap.lstLayer[0].Count; i++) { if (util.getTileType(TileMap.lstLayer[0][i].Gid) == "path") { int aleaNumber = util.getInt(-5, 5); if (aleaNumber == 0) { int posY = (int)(i / TileMap.MapWidth); int posX = i - (TileMap.MapWidth * posY); Vector2 Position = new Vector2(posX * TileMap.TileWidth, posY * TileMap.TileHeight); Console.WriteLine(Position); Champiglu enemie = new Champiglu(EnemieData.Data["Champiglu"], Position, currentScene.myCharacter); SceneGameplay.enemieManager.AddEnemie(enemie); enemieNumber--; if (enemieNumber == 0) { break; } } } } } }
public void Update(GameTime gameTime) { for (int i = 0; i < lstEnemies.Count; i++) { Champiglu a = (Champiglu)lstEnemies[i]; if (lstEnemies[i].Delete) { lstEnemies.RemoveAt(i); } else { lstEnemies[i].Update(gameTime); } } }