当前位置: 首页>>代码示例>>C#>>正文


C# TradeAndTravel.Person类代码示例

本文整理汇总了C#中TradeAndTravel.Person的典型用法代码示例。如果您正苦于以下问题:C# Person类的具体用法?C# Person怎么用?C# Person使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Person类属于TradeAndTravel命名空间,在下文中一共展示了Person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCraftInteraction

        private void HandleCraftInteraction(string[] commandWords, Person actor)
        {
            var craftedItemType = commandWords[2];
            string craftedItemName = commandWords[3];
            Item theNewCraftedItem = null;
            var actorInventory = actor.ListInventory();

            if (craftedItemType == "weapon")
            {
                bool hasWood = PossessTheRequiredItem(actorInventory, ItemType.Wood);
                bool hasIron = PossessTheRequiredItem(actorInventory, ItemType.Iron);

                if (hasWood && hasIron)
                {
                    theNewCraftedItem = new Weapon(craftedItemName);
                    this.AddToPerson(actor, theNewCraftedItem);
                    theNewCraftedItem.UpdateWithInteraction("craft");
                }
            }
            else if (craftedItemType == "armor")
            {
                bool hasIron = PossessTheRequiredItem(actorInventory, ItemType.Iron);

                if (hasIron)
                {
                    theNewCraftedItem = new Armor(craftedItemName);
                    this.AddToPerson(actor, theNewCraftedItem);
                    theNewCraftedItem.UpdateWithInteraction("craft");
                }
            }
        }
开发者ID:BorislavIvanov,项目名称:Telerik_Academy,代码行数:31,代码来源:ModifiedInteractionManager.cs

示例2: HandleCraftInteraction

        private void HandleCraftInteraction(Person actor, string[] commandWords)
        {
            var inventory = actor.ListInventory();

            bool hasIron = false;
            bool hasWood = false;

            foreach (var item in inventory)
            {
                if (item is Iron)
                {
                    hasIron = true;
                }
                else if (item is Wood)
                {
                    hasWood = true;
                }
            }

            if (commandWords[2] == "armor" && hasIron)
            {
                this.AddToPerson(actor, new Armor(commandWords[3], actor.Location));
            }
            else if (commandWords[2] == "weapon" && hasIron && hasWood)
            {
                this.AddToPerson(actor, new Weapon(commandWords[3], "weapon", actor.Location));
            }
        }
开发者ID:nikolay-radkov,项目名称:Telerik-Academy,代码行数:28,代码来源:ImprovedInteractionManger.cs

示例3: HandlePersonCommand

 protected virtual void HandlePersonCommand(string[] commandWords, Person actor)
 {
     switch (commandWords[1])
     {
         case "drop":
             HandleDropInteraction(actor);
             break;
         case "pickup":
             HandlePickUpInteraction(actor);
             break;
         case "sell":
             this.HandleSellInteraction(commandWords, actor);
             break;
         case "buy":
             HandleBuyInteraction(commandWords, actor);
             break;
         case "inventory":
             HandleListInventoryInteraction(actor);
             break;
         case "money":
             Console.WriteLine(moneyByPerson[actor]);
             break;
         case "travel":
             HandleTravelInteraction(commandWords, actor);
             break;
         default:
             break;
     }
 }
开发者ID:alex687,项目名称:SoftUni-Homeworks,代码行数:29,代码来源:InteractionManager.cs

示例4: HandleArmorCrafting

 private void HandleArmorCrafting(Person actor, string itemName)
 {
     if (actor.HasItemInInvetory(ItemType.Iron))
     {
             this.AddToPerson(actor, new Armor(itemName));
     }
 }
开发者ID:monikaBchvarova,项目名称:C-Sharp,代码行数:7,代码来源:InteractionManagerExtended.cs

示例5: HandleGatherInteraction

 private void HandleGatherInteraction(string itemNameString, Person actor)
 {
     var gatherLoc = actor.Location as IGatheringLocation;   
     if (gatherLoc != null && actor.ListInventory().Any(item => item.ItemType == gatherLoc.RequiredItem))
     {
         this.AddToPerson(actor, gatherLoc.ProduceItem(itemNameString));
     }
 }
开发者ID:NikolaPineda,项目名称:Telerik,代码行数:8,代码来源:ExtendedInteractionManager.cs

示例6: CraftArmor

 private void CraftArmor(Person actor, string craftedItemName)
 {
     var actorInventory = actor.ListInventory();
     if (actorInventory.Any((item) => item.ItemType == ItemType.Iron))
     {
         this.AddToPerson(actor, new Armor(craftedItemName));
     }
 }
开发者ID:valkanov,项目名称:TelerikAcademy,代码行数:8,代码来源:AdvancedInteractionManager.cs

示例7: HandleArmorCrafting

 private void HandleArmorCrafting(Person actor, string itemName)
 {
     var itemRequired = ItemType.Iron;
     if (actor.HasItemInInventory(itemRequired))
     {
         this.AddToPerson(actor, new Armor(itemName));
     }
 }
开发者ID:enchev-93,项目名称:Telerik-Academy,代码行数:8,代码来源:ExtendedInteractionManager.cs

示例8: HandleWeaponCrafting

 private void HandleWeaponCrafting(Person actor, string itemName)
 {
     var requiredItems = new List<ItemType> { ItemType.Iron, ItemType.Wood };
     if (requiredItems.All(i => actor.HasItemInInventory(i)))
     {
         this.AddToPerson(actor, new Weapon(itemName));
     }
 }
开发者ID:b-slavov,项目名称:Telerik-Software-Academy,代码行数:8,代码来源:ExtendedInteractionManager.cs

示例9: HandlePersonCommand

 protected override void HandlePersonCommand(string[] commandWords, Person actor)
 {
     switch (commandWords[1])
     {
         case "gather": this.HandleGatherInteraction(commandWords, actor); break;
         case "craft": this.HandleCraftInteraction(commandWords, actor); break;
         default: base.HandlePersonCommand(commandWords, actor); break;
     }
 }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:9,代码来源:ExtendedInteractionManager.cs

示例10: HandleCraftInteraction

        private void HandleCraftInteraction(Person actor, string crafteedItemType, string craftedItemName)
        {

            switch (crafteedItemType)
            {
                default:
                    break;
            }

        }
开发者ID:Roshov,项目名称:Telerik-Software-Academy-,代码行数:10,代码来源:MediatorInteractionManager.cs

示例11: HandleGatherInteraction

 private void HandleGatherInteraction(Person actor, string name)
 {
     if (actor.Location is IGatheringLocation)
     {
         var gatheringLocation = actor.Location as IGatheringLocation;
         if (actor.HasItem(gatheringLocation.RequiredItem))
         {
             this.AddToPerson(actor, gatheringLocation.ProduceItem(name));
         }
     }
 }
开发者ID:Termininja,项目名称:BGCoder,代码行数:11,代码来源:ExtendedInteractionManager.cs

示例12: HandleGatherInteraction

 private void HandleGatherInteraction(string[] commandWords, Person actor)
 {
     if (actor.Location is Forest && actor.ListInventory().Any(item => item is Weapon))
     {
        this.AddToPerson(actor, new Wood(commandWords[2]));
     }
     else if (actor.Location is Mine && actor.ListInventory().Any(item => item is Armor))
     {
         this.AddToPerson(actor, new Iron(commandWords[2]));
     }
 }
开发者ID:reminchev,项目名称:SoftUni-Projects,代码行数:11,代码来源:WorkAndTravelInteractionManager.cs

示例13: HandleGatherInteraction

        protected void HandleGatherInteraction(Person actor, string newName)
        {
            if (actor.Location is IGatheringLocation)
            { 
                var gatheringLocation = actor.Location as IGatheringLocation;

                if (actor.ListInventory().Any(x => x.ItemType == gatheringLocation.RequiredItem))
                {
                    this.AddToPerson(actor, gatheringLocation.ProduceItem(newName));
                }
            }
        }
开发者ID:AndrewMitev,项目名称:Telerik-Academy,代码行数:12,代码来源:ExtendedInteractionManager.cs

示例14: HandleCraftInteraction

        private void HandleCraftInteraction(Person actor, string type, string name)
        {
            if (type == "armor" && actor.HasItem(ItemType.Iron))
            {
                this.AddToPerson(actor, new Armor(name));
            }

            if (type == "weapon" && actor.HasItem(ItemType.Iron) && actor.HasItem(ItemType.Wood))
            {
                this.AddToPerson(actor, new Weapon(name));
            }
        }
开发者ID:Termininja,项目名称:BGCoder,代码行数:12,代码来源:ExtendedInteractionManager.cs

示例15: HandleCraftInteraction

        private void HandleCraftInteraction(string itemNameString, string itemTypeString, Person actor)
        {
            if (itemTypeString == "weapon" && actor.ListInventory().Any(item => item is Iron) && (actor.ListInventory().Any(item => item is Wood)))
            {
                this.AddToPerson(actor, new Weapon(itemNameString));
            }

            if (itemTypeString == "armor" && actor.ListInventory().Any(item => item is Iron))
            {
                this.AddToPerson(actor, new Armor(itemNameString));
            }
        }
开发者ID:NikolaPineda,项目名称:Telerik,代码行数:12,代码来源:ExtendedInteractionManager.cs


注:本文中的TradeAndTravel.Person类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。