當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。