public AdventureObject getAdventureObject() { switch (type) { case ObjectType.hidden: AdventureHidden hidden = new AdventureHidden(enemyType); hidden.location = new Vector2(x, y); return hidden; case ObjectType.special: AdventureSpecial special = new AdventureSpecial(screen, key - 1); special.location = new Vector2(x, y); return special; case ObjectType.stock: AdventureEntity entityFromStock = new AdventureEntity(Master.currentFile.stockEntities[enemyType]); entityFromStock.location = new Vector2(x, y); return entityFromStock; case ObjectType.teleporter: AdventureTeleporter exit = new AdventureTeleporter(dest, destx, desty, destroomX, destroomY); exit.location = new Vector2(x, y); return exit; case ObjectType.entity: AdventureEntity entity = new AdventureEntity(data); entity.location = new Vector2(x, y); return entity; case ObjectType.boss: if (enemyType == 2) { AdventureBoss2 boss2 = new AdventureBoss2(); boss2.location = new Vector2(x, y); return boss2; } else if (enemyType == 3) { AdventureBoss3 boss3 = new AdventureBoss3(); boss3.location = new Vector2(x, y); return boss3; } else if (enemyType == 4) { AdventureBoss4 boss4 = new AdventureBoss4(); boss4.location = new Vector2(x, y); return boss4; } else if (enemyType == 5) { AdventureBoss5 boss5 = new AdventureBoss5(); boss5.location = new Vector2(x, y); return boss5; } else if (enemyType == 6) { AdventureBoss6 boss6 = new AdventureBoss6(); boss6.location = new Vector2(x, y); return boss6; } else if (enemyType == 7) { AdventureBoss7 boss7 = new AdventureBoss7(); boss7.location = new Vector2(x, y); return boss7; } else if (enemyType == 8) { AdventureBoss8 boss8 = new AdventureBoss8(); boss8.location = new Vector2(x, y); return boss8; } else if (enemyType == 9) { AdventureBoss9 boss9 = new AdventureBoss9(); boss9.location = new Vector2(x, y); return boss9; } else if (enemyType == 10) { AdventureBoss9Phase2 boss92 = new AdventureBoss9Phase2(); boss92.location = new Vector2(x, y); return boss92; } else { AdventureBoss1 boss1 = new AdventureBoss1(); boss1.location = new Vector2(x, y); return boss1; } case ObjectType.shooter: AdventureShooter shooter = new AdventureShooter(enemyType == 1); shooter.location = new Vector2(x, y); return shooter; case ObjectType.enemy: AdventureEnemy enemy = new AdventureEnemy(Master.currentFile.bestiary[enemyType], enemyType); enemy.location = new Vector2(x, y); return enemy; case ObjectType.goldkey: AdventureGoldKey goldkey = new AdventureGoldKey(); goldkey.location = new Vector2(x, y); return goldkey; case ObjectType.heart: AdventureHeart heart = new AdventureHeart(); heart.location = new Vector2(x, y); return heart; default: AdventureKey key_ = new AdventureKey(); key_.location = new Vector2(x, y); return key_; } }
// Relevant to code void SpawnKey(int x, int y) { AdventureKey aK = new AdventureKey(); aK.Initialize(this, game); aK.location.X = 32 * x + 16; aK.location.Y = 32 * y + 16; newobjects.Add(aK); adventure.rooms[roomX, roomY].adventureObjects.Add(aK); // So that the key respawns even if you leave the room, but not the adventure PlaySound.Play(PlaySound.SoundEffectName.Aspect); }