Пример #1
0
 private void SpawnEnemyLoot(IEnemy enemy)
 {
     if (enemy.Item != null)
     {
         IItem item = enemy.Item;
         item.X = enemy.X;
         item.Y = enemy.Y;
         Items.Add(item);
     }
     if (Enemies.Count == 0)
     {
         IItem item;
         if (level.Equals("Rooms/Room0.csv"))
         {
             item   = new Key();
             item.X = 320;
             item.Y = 120 + 255; //before adjustments
         }
         else if (level.Equals("Rooms/Room5.csv") || level.Equals("Rooms/Room17.csv"))
         {
             item   = new Key();
             item.X = 265;      //265
             item.Y = 120 + 95; //95 before adjustments
         }
         else if (level.Equals("Rooms/Room10.csv"))
         {
             item   = new Boomerang();
             item.X = 265;      //265
             item.Y = 120 + 95; //95 before adjustments
         }
         else if (level.Equals("Rooms/Room13.csv"))
         {
             item   = new HeartContainer();
             item.X = 385;
             item.Y = 120 + 160; //before adjustments
         }
         else
         {
             item = new Key();
         }
         if (!(item.X == 0 && item.Y == 0))
         {
             Items.Add(item);
         }
     }
 }
Пример #2
0
        public IList <IItem> LoadItems(IDictionary <int, IPlayer> players)
        {
            List <IItem> items = new List <IItem>();
            IDictionary <Vector2, string> itemInfo = parser.Items;

            foreach (KeyValuePair <Vector2, String> entry in itemInfo)
            {
                IItem item;
                if (entry.Value.Equals("Arrow"))
                {
                    item = new Arrow();
                }
                else if (entry.Value.Equals("BlueCandle"))
                {
                    item = new BlueCandle();
                }
                else if (entry.Value.Equals("BluePotion"))
                {
                    item = new BluePotion();
                }
                else if (entry.Value.Equals("BlueRing"))
                {
                    item = new BlueRing(players);
                }
                else if (entry.Value.Equals("BlueRupee"))
                {
                    item = new BlueRupee();
                }
                else if (entry.Value.Equals("Bomb"))
                {
                    item = new Bomb();
                }
                else if (entry.Value.Equals("Bow"))
                {
                    item = new Bow();
                }
                else if (entry.Value.Equals("Boomerang"))
                {
                    item = new Boomerang();
                }
                else if (entry.Value.Equals("Clock"))
                {
                    item = new Clock(players);
                }
                else if (entry.Value.Equals("Compass"))
                {
                    item = new Compass();
                }
                else if (entry.Value.Equals("Fairy"))
                {
                    item = new Fairy();
                }
                else if (entry.Value.Equals("Heart"))
                {
                    item = new Heart();
                }
                else if (entry.Value.Equals("HeartContainer"))
                {
                    item = new HeartContainer();
                }
                else if (entry.Value.Equals("Key"))
                {
                    item = new Key();
                }
                else if (entry.Value.Equals("Map"))
                {
                    item = new Map();
                }
                else if (entry.Value.Equals("Rupee"))
                {
                    item = new Rupee();
                }
                else if (entry.Value.Equals("TriforceShard"))
                {
                    item = new TriforceShard(game);
                }
                else if (entry.Value.Equals("RedRing"))
                {
                    item = new RedRing(players);
                }
                else if (entry.Value.Equals("RedPotion"))
                {
                    item = new RedPotion();
                }
                else if (entry.Value.Equals("WhiteSword"))
                {
                    item = new WhiteSword();
                }
                else //wood sword
                {
                    item = new WoodSword();
                }
                item.X = (int)entry.Key.X;
                item.Y = 120 + (int)entry.Key.Y;
                items.Add(item);
            }
            return(items);
        }