Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public void RegisterFlightPath(EnemyFlightPath newPath)
 {
     flightPaths[newPath.Key] = newPath;
 }
Ejemplo n.º 3
0
        public EnemyFlightPath GetFlightPath(string flightPathKey)
        {
            EnemyFlightPath res = flightPaths[flightPathKey];

            return(res);
        }