本文整理匯總了C#中TradeAndTravel.Location類的典型用法代碼示例。如果您正苦於以下問題:C# Location類的具體用法?C# Location怎麽用?C# Location使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Location類屬於TradeAndTravel命名空間,在下文中一共展示了Location類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TravelTo
public void TravelTo(Location location)
{
if (location != null)
{
this.Location = location;
}
}
示例2: CreateItem
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);
}
}
}
示例3: CreatePerson
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);
}
}
示例4: CreatePerson
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: Item
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;
}
}
}
示例6: CreateItem
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;
}
示例7: CreateItem
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;
}
示例8: CreateItem
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;
}
示例9: CreateItem
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: Weapon
public Weapon(string name, Location location = null)
: base(name, Weapon.InitialValue, ItemType.Weapon, location)
{
}
示例11: CreatePerson
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;
}
示例12: Iron
public Iron(string name, string type, Location location = null)
: base(name, 3, type, location) { }
示例13: Traveller
public Traveller(string name, Location location)
: base(name, location)
{
}
示例14: Iron
public Iron(string name, Location location = null)
: base(name, Iron.GeneralIronValue, ItemType.Iron, location)
{
}
示例15: Person
public Person(string name, Location location)
: base(name)
{
this.Location = location;
this.inventoryItems = new HashSet<Item>();
}