/* * MeteorPhaseQueue.cs * Authors: August Zinsser * * Copyright Matthew Belmonte 2007 */ using System; using System.Collections.Generic; using System.Text; using tAC_Engine; namespace Astropolis { /// /// All phases used in Meteor Madness /// public class MeteorPhases : GenericPhases { public const string DotTest = "DotTest"; public const string IdentityTest = "IdentityTest"; public const string Shooter = "Shooter"; public const string Boss = "Boss"; public const string DotTest2ShooterTransition = "DotTest2ShooterTransition"; public const string Shooter2DotTestTransition = "Shooter2DotTestTransition"; public const string Shooter2BossTransition = "Shooter2BossTransition"; /// /// Checks if the phaseName exists in this minigame /// /// /// public override bool Contains(string phaseName) { mList.Clear(); if (mList.Count == 0) { mList.Add(DotTest); mList.Add(IdentityTest); mList.Add(Shooter); mList.Add(Boss); mList.Add(DotTest2ShooterTransition); mList.Add(Shooter2DotTestTransition); } return mList.Contains(phaseName); } } /// /// Each test /// public class MeteorTest : GenericTest { /// /// Converts a generic test into a Meteor Madness test /// /// public MeteorTest(GenericTest genericTest) : base (genericTest.PhaseName, genericTest.Trials, null) { // Validate the input from the config file mPhases = new MeteorPhases(); if (!mPhases.Contains(genericTest.PhaseName)) GenericBaseApplication.GameManager.PrintAndDie("Unrecognized test phase name " + genericTest.PhaseName + ". Try reinstalling this program."); } } /// /// The queue used to control the flow of meteor madness /// class MeteorPhaseQueue : GenericPhaseQueue { /// /// Converts a generic phase queue into a Meteor Madness phae queue /// public MeteorPhaseQueue(GenericPhaseQueue genericPhaseQueue) { while (genericPhaseQueue.Count > 0) mTestQueue.Enqueue(new MeteorTest(genericPhaseQueue.Dequeue())); } /// /// Returns the oldest test in the queue /// /// public new MeteorTest Dequeue() { return (MeteorTest)mTestQueue.Dequeue(); } } }