//Initialize game data private void Initialize() { //Enemies this.currentEnemies = new ObservableCollection <Enemy>(); //When enemy is added or removed from collection "updateEnimies" is automatically called this.currentEnemies.CollectionChanged += UpdateEnemies; //Initialize lists this.playerBullets = new List <PlayerBullet>(); this.enemyBullets = new List <EnemyBullet>(); this.deadBullets = new List <Bullet>(); //Initialize enemy factories this.enemyAFact = new EnemyAFactory(); this.enemyBFact = new EnemyBFactory(); this.midBossFact = new MidBossFactory(); this.finalBossFact = new FinalBossFactory(); //Initialize bullet factories this.playerBulletFact = new PlayerBulletFactory(); this.playerSpecBulletFact = new PlayerSpecialBulletFactory(); this.enemyABulletFact = new EnemyABulletFactory(); this.enemyBBulletFact = new EnemyBBulletFactory(); this.midBossBulletFact = new MidBossBulletFactory(); this.finalBossBulletFact = new FinalBossBulletFactory(); //Set difficulty to medium to start difficulty = Difficulty.Medium; }
//Our enemy factory machine public static EnemyAbstractFactory MakeFactory(EnemyConfig enemy) { //Make our abstract factory object to return EnemyAbstractFactory factory = null; //Find out what type of enemy we're dealing with and return the appropriate factory switch (enemy.enemyType) { case EnemyType.EnemyA: factory = new EnemyAFactory(); break; case EnemyType.EnemyB: factory = new EnemyBFactory(); break; case EnemyType.MidBoss: factory = new MidBossFactory(); break; case EnemyType.FinalBoss: factory = new FinalBossFactory(); break; } return(factory); }
// Constructor public SpawnEnemyB(BulletManager bulletManager, GameData gameData) { this.bulletManager = bulletManager; this._reciever = gameData.EnemyBFact; this._myGameData = gameData; this._myEnemyConfig = null; }