public void testThreeActOnMovesGameCharacter() { bool passed = false; HPone = new HiddenPassage(); HPtwo = new HiddenPassage(HPone); bob = new Mage(); HPone.testPlayerPosition = new IntVec(5, 3); HPone.testPosition = new IntVec(5, 4); HPtwo.testPosition = new IntVec(2, 6); HPone.directionFacing = Direction.UP; HPtwo.directionFacing = Direction.DOWN; IntVec preveosSpot = HPone.testPlayerPosition; HPone.actOn(bob); HPtwo.actOn(bob); IntVec finalSpot = HPone.testPlayerPosition; HPone = new HiddenPassage(); if (preveosSpot != finalSpot) { passed = true; } if (!passed) { throw new System.ArgumentException("The GameCharacter position did not change", "testThreeActOnMovesGameCharacter"); } }
public void testThreeActOnSwichToObject() { bool passed = false; bob = new Mage(); stair = new Stairs(); stair.actOn(bob); if (stair.calledNextLevel == true) { passed = true; } if (!passed) { throw new System.ArgumentException("Switch acting on object", "testThreeActOnSwichToObject"); } }
public void testThreeActOnSwichToObject() { bool passed = false; bob = new Mage(); targetObject = new Door(Direction.UP); lever = new Switch(targetObject); Direction first = targetObject.directionFacing; lever.actOn(bob); Direction second = targetObject.directionFacing; if (first != second) { passed = true; } if (!passed) { throw new System.ArgumentException("Switch acting on object", "testThreeActOnSwichToObject"); } }
public static void LoadGame(string filename) { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); SaveGameData gd = (SaveGameData)formatter.Deserialize(stream); stream.Close(); File.Delete(filename); //Create a new class of the hero just to set the static texture. GameCharacter temp; switch (gd.heroRole) { case Enums.Classes.Mage: temp = new HeroClasses.Mage(); break; case Enums.Classes.Warrior: temp = new HeroClasses.Warrior(); break; case Enums.Classes.Rogue: temp = new HeroClasses.Rogue(); break; case Enums.Classes.Brawler: temp = new HeroClasses.Brawler(); break; case Enums.Classes.Magus: temp = new HeroClasses.Magus(); break; case Enums.Classes.Duelist: temp = new HeroClasses.Duelist(); break; case Enums.Classes.Sentinel: temp = new HeroClasses.Sentinel(); break; case Enums.Classes.Sorcerer: temp = new HeroClasses.Sorcerer(); break; case Enums.Classes.Ranger: temp = new HeroClasses.Ranger(); break; case Enums.Classes.Marksman: temp = new HeroClasses.Marksman(); break; case Enums.Classes.Berserker: temp = new HeroClasses.Berserker(); break; case Enums.Classes.Juggernaut: temp = new HeroClasses.Juggernaut(); break; case Enums.Classes.SpellBlade: temp = new HeroClasses.SpellBlade(); break; case Enums.Classes.SpellWeaver: temp = new HeroClasses.Spellweaver(); break; case Enums.Classes.Assassin: temp = new HeroClasses.Assassin(); break; } currentSaveSlot = gd.saveSlot; hero = gd.character; HeroClasses.Hero.level = gd.level; HeroClasses.Hero.jarBarAmount = gd.jarBarAmount; HeroClasses.Hero.MaxJarBarAmount = gd.jarBarMax; HeroClasses.Hero.heroRole = gd.heroRole; UpdateAbilities(); GeneratedLevel nlevel = new GeneratedLevel(gd.seed, gd.levelComplexity, gd.dungeonLevel); currentLevel = nlevel.RetrieveLevel(); currentLevel.CharacterEntities.Add(hero, currentLevel.GetStartPoint()); showSaveSlotSelection = false; mainMenuOpen = false; gameStarted = true; }