Exemple #1
0
 internal void Equip(string weaponName)
 {
     foreach (Weapon weapon in inventory)
     {
         if (weapon.Name == weaponName)
             equippedWeapon = weapon;
     }
 }
Exemple #2
0
        public void NewLevel(Random random)
        {
            level++;
               switch (level)
               {
               case 1:
                   Enemies = new List<Enemy>();
                   Enemies.Add(new Bat(this, GetRandomLocation(random), boundaries));
                   WeaponInRoom = new Sword(this, GetRandomLocation(random));
                   break;

               case 2:
                   Enemies.Add(new Ghost(this, GetRandomLocation(random), boundaries));
                   break;

               case 3:
                   Enemies.Add(new Ghoul(this, GetRandomLocation(random), boundaries));

                   break;
               case 4:
                   Enemies.Add(new Bat(this, GetRandomLocation(random), boundaries));
                   Enemies.Add(new Ghost(this, GetRandomLocation(random), boundaries));

                   break;
               case 5:
                   Enemies.Add(new Bat(this, GetRandomLocation(random), boundaries));
                   Enemies.Add(new Ghoul(this, GetRandomLocation(random), boundaries));

                   break;
               case 6:
                   Enemies.Add(new Ghost(this, GetRandomLocation(random), boundaries));
                   Enemies.Add(new Ghoul(this, GetRandomLocation(random), boundaries));

                   break;
               case 7:
                   Enemies.Add(new Bat(this, GetRandomLocation(random), boundaries));
                   Enemies.Add(new Ghost(this, GetRandomLocation(random), boundaries));
                   Enemies.Add(new Ghoul(this, GetRandomLocation(random), boundaries));

                   break;

               default:
                   break;

               }
        }
Exemple #3
0
 public static Weapon LoadWeaponFromXml(XmlElement node)
 {
     string name = node.GetAttribute("name");
     int nrFacets = int.Parse(node.GetAttribute("nrfacets"));
     Characteristics ch = LoadCharacteristicsFromXml((XmlElement)node.GetElementsByTagName("Characteristics")[0]);
     string[] b = LoadBodyFromXML((XmlElement)node.GetElementsByTagName("Body")[0]);
     Weapon w = new Weapon(name, ch, b, nrFacets);
     string script = node.GetAttribute("script");
     if(script != "")
         w.SetScript(script);
     try
     {
         string symbol = node.GetAttribute("symbol");
         w.SetSymbol(symbol);
     }
     catch
     {}
     return w;
 }