Beispiel #1
0
        public static void NextLevel()
        {
            string currentLevel       = Harness.GameCurrentLevel.ToString();
            string currentLevelNumber = currentLevel.Substring(currentLevel.Length - 2);
            int    currentLevelInt    = -1;
            string nextLevelNumber    = "";
            string nextLevel          = "";

            if (Int32.TryParse(currentLevelNumber, out currentLevelInt))
            {
                if (++currentLevelInt < 10)
                {
                    nextLevelNumber = "0" + currentLevelInt.ToString();
                }
                else
                {
                    nextLevelNumber = currentLevelInt.ToString();
                }
            }
            else
            {
                Harness.GameCurrentLevel = new Level00();
            }
            nextLevel = "LogicGates.Models.Level" + nextLevelNumber;

            Type type = Type.GetType(nextLevel, false);

            if (type == null)
            {
                Harness.GameCurrentLevel = new Level99();
            }
            else
            {
                Harness.GameCurrentLevel = (Level)Activator.CreateInstance(type);
                Harness.SaveGame();
            }
            Harness.RefreshOutput();
        }
Beispiel #2
0
 public static void ResetGame()
 {
     Harness.GameCurrentLevel = new Level01();
     Harness.SaveGame();
     Harness.RefreshOutput();
 }