protected override Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
        {
            switch (itemTypeString)
            {
                case "weapon":
                    {
                        item = new Weapon(itemNameString, itemLocation);
                        return item;
                    }
                case "wood":
                    {
                        item = new Wood(itemNameString, itemLocation);
                        return item;
                    }
                case "iron":
                    {
                        item = new Iron(itemNameString, itemLocation);
                        return item;
                    }

                default:
                    {
                        return base.CreateItem(itemTypeString, itemNameString, itemLocation, item);
                    }
            }
        }
Пример #2
0
 public void TravelTo(Location location)
 {
     if (location != null)
     {
         this.Location = location;
     }
 }
 protected override Person CreatePerson(string personTypeString, string personNameString, Location personLocation)
 {
     switch (personTypeString)
     { 
         case "merchant":
             return new Merchant(personNameString, personLocation);
         default:
             return base.CreatePerson(personTypeString, personNameString, personLocation);
     }
 }
 protected override Person CreatePerson(string personTypeString, string personNameString, Location personLocation)
 {
     Person person = null;
     switch (personTypeString)
     {
         case "merchant":
             person = new Merchant(personNameString, personLocation);
             break;
         default: return base.CreatePerson(personTypeString, personNameString, personLocation);
     }
     return person;
 }
Пример #5
0
        protected Item(string name, int itemValue, string type, Location location = null)
            : base(name)
        {
            this.Value = itemValue;

            foreach (var itemType in (ItemType[])Enum.GetValues(typeof(ItemType)))
            {
                if (itemType.ToString() == type)
                {
                    this.ItemType = itemType;
                }
            }
        }
 protected override Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
 {
     switch (itemTypeString)
     {
         case "weapon":
             item = new Weapon(itemNameString, itemLocation);
             break;
         case "iron":
             item = new Iron(itemNameString, itemLocation);
             break;
         default:
             return base.CreateItem(itemTypeString, itemNameString, itemLocation,item);
             break;
     }
     return item;
 }
        protected override Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
        {
            Item itemToBeCreated = null;
            switch (itemTypeString)
            {
                case "weapon":
                    itemToBeCreated = new Weapon(itemNameString, itemLocation);
                    break;
                case "wood":
                    itemToBeCreated = new Wood(itemNameString, itemLocation);
                    break;
                default:
                    itemToBeCreated = base.CreateItem(itemTypeString, itemNameString, itemLocation, itemToBeCreated);
                    break;
            }

            return itemToBeCreated;
        }
 protected virtual Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
 {
     switch (itemTypeString)
     {
         case "armor":
             item = new Armor(itemNameString, itemLocation);
             break;
         case "weapon":
             item = new Weapon(itemNameString, itemLocation);
             break;
         case "wood":
             item = new Wood(itemNameString, itemLocation);
             break;
         case "iron":
             item = new Iron(itemNameString, itemLocation);
             break;
         default:
             break;
     }
     return item;
 }
        protected override Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
        {
            if (itemTypeString == "armor")
            {
                base.CreateItem(itemTypeString, itemNameString, itemLocation, item);
            }

            switch (itemTypeString)
            {
                case "weapon":
                    item = new Weapon(itemNameString, itemLocation);
                    break;
                case "wood":
                    item = new Wood(itemNameString, itemLocation);
                    break;
                case "iron":
                    item = new Iron(itemNameString, itemLocation);
                    break;
                default:
                    break;
            }

            return item;
        }
Пример #10
0
 public Weapon(string name, Location location = null)
     : base(name, Weapon.InitialValue, ItemType.Weapon, location)
 {
 }
Пример #11
0
 public Iron(string name, string type, Location location = null)
     : base(name, 3, type, location) { }
Пример #12
0
 protected Item(string name, int itemValue, ItemType type, Location location = null)
     : base(name)
 {
     this.Value = itemValue;
     this.ItemType = type;
 }
Пример #13
0
 public Iron(string name, Location location = null)
     : base(name, Iron.GeneralIronValue, ItemType.Iron, location)
 {
 }
 protected virtual Person CreatePerson(string personTypeString, string personNameString, Location personLocation)
 {
     Person person = null;
     switch (personTypeString)
     {
         case "shopkeeper":
             person = new Shopkeeper(personNameString, personLocation);
             break;
         case "traveller":
             person = new Traveller(personNameString, personLocation);
             break;
         default:
             break;
     }
     return person;
 }
Пример #15
0
 public Weapon(string name, string type, Location location = null)
    : base(name, 10, type, location) {}
Пример #16
0
 public Wood(string name, string type, Location location = null)
     : base(name, 2, type, location) { }
Пример #17
0
 public Armor(string name, Location location = null)
     : base(name, Armor.GeneralArmorValue, ItemType.Armor, location)
 {
 }
Пример #18
0
 public Person(string name, Location location)
     : base(name)
 {
     this.Location = location;
     this.inventoryItems = new HashSet<Item>();
 }
Пример #19
0
 public Iron(string name, Location location = null)
     : base(name, Iron.MoneyValue, ItemType.Iron, location)
 {
 }
Пример #20
0
 public Wood(string name, Location location = null)
     : base(name, 2, ItemType.Wood, location)
 {
 }
Пример #21
0
 public Wood(string name, Location location = null)
     : base(name, 2, ItemType.Wood, location)
 {
 }
Пример #22
0
 public Weapon(string name, Location location = null)
     : base(name, 10, ItemType.Weapon, location)
 {
 }
Пример #23
0
 public Iron(string name, Location location = null)
     : base(name, 3, ItemType.Iron, location)
 {
 }
Пример #24
0
 public Merchant(string name, Location location)
     : base(name, location)
 {
 }
Пример #25
0
 public Shopkeeper(string name, Location location)
     : base(name, location)
 {
 }
Пример #26
0
 public virtual void TravelTo(Location location)
 {
     this.Location = location;
 }
Пример #27
0
 public Traveller(string name, Location location)
     : base(name, location)
 {
 }
Пример #28
0
 public Wood(string name, Location location = null) 
     : base(name, GeneralWoodValue, ItemType.Wood, location)
 {
 }
Пример #29
0
 public Wood(string name, Location location = null)
     : base(name, Wood.MoneyValue, ItemType.Wood, location)
 {
 }
Пример #30
0
 public Weapon(string name, Location location = null)
     : base(name, Weapon.GeneralWeaponValue, ItemType.Weapon, location)
 {
 }
        protected override Person CreatePerson(string personTypeString, string personNameString, Location personLocation)
        {
            if (personTypeString != "merchant")
            {
                return base.CreatePerson(personTypeString, personNameString, personLocation);
            }

            Person person = null;
            person = new Merchant(personNameString, personLocation);

            return person;
        }