public PillarBatch(BackgroundManager backgroundManager, SpriteBatch spriteBatch, Soul game, int lowestSpawn, int highestSpawn, int deadTime, float direction, bool randomDirection, bool randomSpeed, float layer, bool persistScroll) { this.backgroundManager = backgroundManager; this.randomSpeed = randomSpeed; this.fileNameList = new List<string>(); this.persistScroll = persistScroll; CreateFileNameList(); this.spriteBatch = spriteBatch; this.game = game; this.layer = layer; this.scrollSpeed = direction; this.randomDirection = randomDirection; this.pillarList = new List<BackgroundPillar>(); this.killList = new List<BackgroundPillar>(); this.random = new Random(); this.lowestSpawn = lowestSpawn; this.highestSpawn = highestSpawn; SetNewSpawnRate(); this.deadTime = deadTime; }
private void CreateBackgrounds() { List<BackgroundData> bgDataBack = levelReader.BackgroundDataListBack; backgroundManager_back = new BackgroundManager(spriteBatch, game); for (int i = 0; i < bgDataBack.Count; i++) { if (bgDataBack[i].SpawnTime != 0) { backgroundManager_back.addToQueue(bgDataBack[i]); } else if (bgDataBack[i].Type == "Scrolling") { ScrollingBackground bg = new ScrollingBackground(spriteBatch, game, bgDataBack[i].Filename, "bg" + i.ToString(), bgDataBack[i].SpawnTime, bgDataBack[i].DeleteTime, bgDataBack[i].Direction, bgDataBack[i].Layer, bgDataBack[i].PersistScroll); backgroundManager_back.addBackground(bg); } else if (bgDataBack[i].Type == "Pillar") { BackgroundPillar bg = new BackgroundPillar(spriteBatch, game, backgroundManager_back.getPillarFileName(bgDataBack[i].Filename), bgDataBack[i].SpawnTime, bgDataBack[i].Direction, bgDataBack[i].Layer, bgDataBack[i].PersistScroll); backgroundManager_back.addBackground(bg); } else if (bgDataBack[i].Type == "Batch") { PillarBatch bg = new PillarBatch(backgroundManager_back, spriteBatch, game, bgDataBack[i].LowestSpawnRate, bgDataBack[i].HighestSpawnRate, (int)bgDataBack[i].DeleteTime, bgDataBack[i].Direction, bgDataBack[i].RandomDirection, bgDataBack[i].RandomSpeed, bgDataBack[i].Layer, bgDataBack[i].PersistScroll); backgroundManager_back.addBackground(bg); } } List<BackgroundData> bgDataFront = levelReader.BackgroundDataListFront; backgroundManager_front = new BackgroundManager(spriteBatch, game); for (int i = 0; i < bgDataFront.Count; i++) { if (bgDataFront[i].SpawnTime != 0) { backgroundManager_front.addToQueue(bgDataFront[i]); } else if (bgDataFront[i].Type == "Scrolling") { ScrollingBackground bg = new ScrollingBackground(spriteBatch, game, bgDataFront[i].Filename, "bg" + i.ToString(), bgDataFront[i].SpawnTime, bgDataFront[i].DeleteTime, bgDataFront[i].Direction, bgDataFront[i].Layer, bgDataFront[i].PersistScroll); backgroundManager_front.addBackground(bg); } else if (bgDataFront[i].Type == "Pillar") { BackgroundPillar bg = new BackgroundPillar(spriteBatch, game, backgroundManager_front.getPillarFileName(bgDataFront[i].Filename), bgDataFront[i].SpawnTime, bgDataFront[i].Direction, bgDataFront[i].Layer, bgDataFront[i].PersistScroll); backgroundManager_front.addBackground(bg); } else if (bgDataFront[i].Type == "Batch") { PillarBatch bg = new PillarBatch(backgroundManager_front, spriteBatch, game, bgDataFront[i].LowestSpawnRate, bgDataFront[i].HighestSpawnRate, (int)bgDataFront[i].DeleteTime, bgDataFront[i].Direction, bgDataFront[i].RandomDirection, bgDataFront[i].RandomSpeed, bgDataFront[i].Layer, bgDataFront[i].PersistScroll); backgroundManager_front.addBackground(bg); } } }