public void Spawn(Game1 game, Vector2 spawnPos) { Enemy enemy = (Enemy)Activator.CreateInstance(enemyType); if (enemy == null) { game.Log.Error(String.Format("Could not create instance: {0}", enemyType.Name)); return; } enemy.Init(game); enemy.geometry.Position = spawnPos; EnemyFlightPath flightPath = game.GetFlightPath(flightPathKey); if (flightPath == null) { game.Log.Error(String.Format("No flightpath registered to key: {0}", flightPathKey)); return; } flightPath.InitEnemy(enemy); game.AddEntity(enemy); }
public void RegisterFlightPath(EnemyFlightPath newPath) { flightPaths[newPath.Key] = newPath; }
public EnemyFlightPath GetFlightPath(string flightPathKey) { EnemyFlightPath res = flightPaths[flightPathKey]; return(res); }