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


C# GameLogic.GameState类代码示例

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


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

示例1: AddBlueBackedCardToTrail

 public List<PossibleTrailSlot[]> AddBlueBackedCardToTrail(GameState game, PossibleTrailSlot[] trail)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     Location currentLocation = Location.Nowhere;
     for (int i = 0; i < 6; i++)
     {
         if (trail[i].Location != Location.Nowhere)
         {
             currentLocation = trail[i].Location;
             break;
         }
     }
     List<PossibleTrailSlot> possibleCards = new List<PossibleTrailSlot>();
     List<Location> possibleLocations = game.Map.LocationsConnectedBySeaTo(currentLocation);
     foreach (Location location in possibleLocations)
     {
         if (!TrailContainsLocation(trail, location) && game.Map.TypeOfLocation(location) == LocationType.Sea && !game.LocationIsBlocked(location))
         {
             possibleCards.Add(new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Blue));
         }
     }
     foreach (PossibleTrailSlot possibleCard in possibleCards)
     {
         PossibleTrailSlot[] newTrail = new PossibleTrailSlot[6];
         for (int i = 5; i > 0; i--)
         {
             newTrail[i] = trail[i - 1];
         }
         newTrail[0] = possibleCard;
         newPossibilityTree.Add(newTrail);
     }
     return newPossibilityTree;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:33,代码来源:DecisionMaker.cs

示例2: AddEventCardToDraculaKnownCardsIfNotAlreadyKnown

 /// <summary>
 /// Checks if a given Event card is already known by Dracula to be in a given Hunter's hand and adds it if not
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterRevealingCard">The Hunter revealing the card</param>
 /// <param name="eventBeingRevealed">The Event being revealed</param>
 /// <returns>The card corresponding to the Event revealed</returns>
 private static EventCard AddEventCardToDraculaKnownCardsIfNotAlreadyKnown(GameState game,
     HunterPlayer hunterRevealingCard, Event eventBeingRevealed)
 {
     var eventCardBeingRevealed =
         hunterRevealingCard.EventsKnownToDracula.Find(card => card.Event == eventBeingRevealed);
     if (eventCardBeingRevealed == null)
     {
         eventCardBeingRevealed = game.EventDeck.Find(card => card.Event == eventBeingRevealed);
         game.EventDeck.Remove(eventCardBeingRevealed);
         hunterRevealingCard.EventsKnownToDracula.Add(eventCardBeingRevealed);
     }
     return eventCardBeingRevealed;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:20,代码来源:Program.cs

示例3: AddBlueBackedCardToAllPossibleTrails

 public void AddBlueBackedCardToAllPossibleTrails(GameState game)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     foreach (PossibleTrailSlot[] trail in PossibilityTree)
     {
         Location currentLocation = Location.Nowhere;
         for (int i = 0; i < 6; i++)
         {
             if (trail[i].Location != Location.Nowhere)
             {
                 currentLocation = trail[i].Location;
                 break;
             }
         }
         List<PossibleTrailSlot> possibleCards = new List<PossibleTrailSlot>();
         List<Location> possibleLocations = game.Map.LocationsConnectedBySeaTo(currentLocation);
         foreach (Location location in possibleLocations)
         {
             if (!TrailContainsLocation(trail, location) && game.Map.TypeOfLocation(location) == LocationType.Sea && !game.LocationIsBlocked(location))
             {
                 possibleCards.Add(new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Blue));
             }
         }
         foreach (PossibleTrailSlot possibleCard in possibleCards)
         {
             PossibleTrailSlot[] newTrail = new PossibleTrailSlot[6];
             for (int i = 5; i > 0; i--)
             {
                 newTrail[i] = trail[i - 1];
             }
             newTrail[0] = possibleCard;
             newPossibilityTree.Add(newTrail);
         }
     }
     PossibilityTree = newPossibilityTree;
     if (PossibilityTree.Count() == 0)
     {
         Console.WriteLine("Dracula stopped believing he exists after running AddBlueBackedCardToAllPossibleTrails");
         PossibilityTree.Add(GetActualTrail(game));
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:41,代码来源:DecisionMaker.cs

示例4: DraculaIsPlayingSeduction

 /// <summary>
 /// Determines if Dracula is playing Seduction at the start of an Encounter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Seduction</returns>
 private static bool DraculaIsPlayingSeduction(GameState game, DecisionMaker logic)
 {
     if (logic.ChooseToPlaySeduction(game))
     {
         Console.WriteLine("Dracula is playing Seduction");
         game.Dracula.DiscardEvent(Event.Seduction, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.Seduction, Event.Seduction, logic) > 0)
         {
             Console.WriteLine("Seduction cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:21,代码来源:Program.cs

示例5: UseItem

 /// <summary>
 /// Resolves a Hunter using an Item outside of combat
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="itemName">The string to be converted to the Item being used</param>
 /// <param name="hunterIndex">The string to be converted to the Hunter using the Item</param>
 private static void UseItem(GameState game, string itemName, string hunterIndex)
 {
     var index = 0;
     var hunterUsingItem = Hunter.Nobody;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterUsingItem = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterUsingItem == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is using an Item? {0}= {1}, {2}= {3}, {4}= {5}, {6}= {7} (-1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
             Hunter.MinaHarker.Name());
         line = Console.ReadLine();
         if (int.TryParse(line, out index))
         {
             if (index == -1)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterUsingItem = game.GetHunterFromInt(index);
             Console.WriteLine(hunterUsingItem.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     var itemBeingUsed = Enumerations.GetItemFromString(itemName);
     while (itemBeingUsed == Item.None && line.ToLower() != "cancel")
     {
         Console.WriteLine("What is the name of the Item being used?");
         line = Console.ReadLine();
         itemBeingUsed = Enumerations.GetItemFromString(line);
     }
     if (line.ToLower() == "cancel")
     {
         Console.WriteLine("Cancelled");
         return;
     }
     switch (itemBeingUsed)
     {
         case Item.Dogs:
             Console.WriteLine("Dogs is now face up in front of {0}", hunterUsingItem.Name());
             game.Hunters[(int)hunterUsingItem].SetDogsFaceUp(true);
             AddItemCardToDraculaKnownCardsIfNotAlreadyKnown(game, game.Hunters[(int)hunterUsingItem], Item.Dogs); break;
         case Item.LocalRumors:
             var trailIndex = -1;
             Console.WriteLine(
                 "In which trail position (1-6) or Catacombs position (7-9) would you like to reveal an Encounter?");
             while (trailIndex == -1)
             {
                 if (int.TryParse(Console.ReadLine(), out trailIndex))
                 {
                     if (trailIndex < 1 || trailIndex > 9)
                     {
                         trailIndex = -1;
                     }
                 }
             }
             if (trailIndex < 7)
             {
                 game.Dracula.RevealEncountersAtPositionInTrail(trailIndex - 1);
             }
             else
             {
                 if (game.Dracula.Catacombs[trailIndex - 7] != null &&
                     game.Dracula.Catacombs[trailIndex - 7].EncounterTiles.Count() > 1)
                 {
                     var encounterIndex = -1;
                     while (encounterIndex == -1)
                     {
                         Console.WriteLine("Which Encounter would you like to reveal? 1 or 2");
                         if (int.TryParse(Console.ReadLine(), out encounterIndex))
                         {
                             if (encounterIndex < 1 || encounterIndex > 2)
                             {
                                 encounterIndex = -1;
                             }
                         }
                     }
                     game.Dracula.RevealEncounterAtPositionInTrail(game, trailIndex - 1, encounterIndex - 1);
                 }
                 else
                 {
                     game.Dracula.RevealEncountersAtPositionInTrail(trailIndex - 1);
                 }
             }
             game.Hunters[(int)hunterUsingItem].DiscardItem(game, Item.LocalRumors);
             DrawGameState(game); break;
         case Item.HolyWater:
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例6: LikelihoodOfHavingItemOfType_1ItemKnown_Returns1

 public void LikelihoodOfHavingItemOfType_1ItemKnown_Returns1()
 {
     GameState game = new GameState();
     ItemCard knife = game.ItemDeck.Find(card => card.Item == Item.Knife);
     vanHelsing.DrawItemCard();
     vanHelsing.ItemsKnownToDracula.Add(knife);
     game.ItemDeck.Remove(knife);
     Assert.AreEqual(1, vanHelsing.LikelihoodOfHavingItemOfType(game, Item.Knife));
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:9,代码来源:HunterPlayerTests.cs

示例7: SetupGroup

 /// <summary>
 /// Adds and removes people from the given Hunter's group
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter with whom to set up a group</param>
 private static void SetupGroup(GameState game, string hunterIndex)
 {
     var hunterFormingGroup = Hunter.Nobody;
     int index;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterFormingGroup = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterFormingGroup == Hunter.Nobody && index != -1)
     {
         Console.WriteLine(
             "Who is forming a group? {0}= {1}, {2}= {3}, {4}= {5} (Mina Harker cannot lead a group, -1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name());
         line = Console.ReadLine();
         if (int.TryParse(line, out index))
         {
             if (index == -1)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             if (index == 4)
             {
                 Console.WriteLine("Mina Harker cannot lead a group, add her to someone else's group instead");
             }
             else
             {
                 hunterFormingGroup = game.GetHunterFromInt(index);
                 Console.WriteLine(hunterFormingGroup.Name());
             }
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     while (index != -1)
     {
         Console.WriteLine("These are the people in {0}'s group:", hunterFormingGroup.Name());
         foreach (var h in game.Hunters[(int)hunterFormingGroup].HuntersInGroup)
         {
             if (h != hunterFormingGroup)
             {
                 Console.WriteLine(h.Name());
             }
         }
         var hunterToAddOrRemove = Hunter.Nobody;
         while (hunterToAddOrRemove == Hunter.Nobody && index != -1)
         {
             Console.WriteLine(
                 "Who is joining or leaving {0}'s group? {1}= {2}, {3}= {4}, {5}= {6} (Lord Godalming must lead any group he is in, -1 to cancel)",
                 hunterFormingGroup.Name(), (int)Hunter.DrSeward, Hunter.DrSeward.Name(),
                 (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
                 Hunter.MinaHarker.Name());
             line = Console.ReadLine();
             if (int.TryParse(line, out index))
             {
                 if (index == -1)
                 {
                     Console.WriteLine("Cancelled");
                     return;
                 }
                 if (index == 1)
                 {
                     Console.WriteLine("Lord Godalming must lead any group he is in");
                 }
                 else
                 {
                     hunterToAddOrRemove = game.GetHunterFromInt(index);
                     Console.WriteLine(hunterFormingGroup.Name());
                 }
             }
             else
             {
                 Console.WriteLine("I didn't understand that");
             }
         }
         if ((int)hunterToAddOrRemove < (int)hunterFormingGroup)
         {
             Console.WriteLine("{0} cannot join {1}'s group, instead add {1} to {0}'s group",
                 hunterToAddOrRemove.Name(), hunterFormingGroup.Name());
         }
         else if (hunterToAddOrRemove == hunterFormingGroup)
         {
             Console.WriteLine("{0} is already in his own group, of course!", hunterFormingGroup.Name());
         }
         else if (game.Hunters[(int)hunterFormingGroup].HuntersInGroup.Contains(hunterToAddOrRemove))
         {
             game.Hunters[(int)hunterFormingGroup].HuntersInGroup.Remove(hunterToAddOrRemove);
         }
         else
         {
             game.Hunters[(int)hunterFormingGroup].HuntersInGroup.Add(hunterToAddOrRemove);
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例8: DrawGameState

 /// <summary>
 /// Draws the gamestate on the screen
 /// </summary>
 /// <param name="game">The GameState</param>
 private static void DrawGameState(GameState game)
 {
     // line 1
     Console.WriteLine("Trail                       Catacombs       Time          Vampires   Resolve   Dracula Ally   Hunter Ally");
     // line 2
     for (var i = 5; i >= 0; i--)
     {
         if (game.Dracula.Trail[i] != null)
         {
             Console.ForegroundColor = game.Dracula.Trail[i].DraculaCards.First().Color;
             if (game.Dracula.Trail[i].DraculaCards.First().IsRevealed)
             {
                 Console.Write(game.Dracula.Trail[i].DraculaCards.First().Abbreviation + " ");
             }
             else
             {
                 Console.Write("### ");
             }
         }
         else
         {
             Console.Write("    ");
         }
     }
     Console.Write("    ");
     for (var i = 0; i < 3; i++)
     {
         if (game.Dracula.Catacombs[i] != null)
         {
             Console.ForegroundColor = game.Dracula.Catacombs[i].DraculaCards.First().Color;
             if (game.Dracula.Catacombs[i].DraculaCards.First().IsRevealed)
             {
                 Console.Write(game.Dracula.Catacombs[i].DraculaCards.First().Abbreviation + " ");
             }
             else
             {
                 Console.Write("### ");
             }
         }
         else
         {
             Console.Write("    ");
         }
     }
     switch (game.TimeOfDay)
     {
         case TimeOfDay.Dawn:
         case TimeOfDay.Dusk:
             Console.ForegroundColor = ConsoleColor.DarkYellow; break;
         case TimeOfDay.Noon:
             Console.ForegroundColor = ConsoleColor.Yellow; break;
         case TimeOfDay.Midnight:
             Console.ForegroundColor = ConsoleColor.Blue; break;
         case TimeOfDay.Twilight:
         case TimeOfDay.SmallHours:
             Console.ForegroundColor = ConsoleColor.DarkBlue; break;
     }
     Console.Write("    {0}", game.TimeOfDay.Name());
     Console.ResetColor();
     for (var i = game.TimeOfDay.Name().Length; i < 14; i++)
     {
         Console.Write(" ");
     }
     Console.Write(game.Vampires);
     for (var i = game.Vampires.ToString().Length; i < 11; i++)
     {
         Console.Write(" ");
     }
     Console.Write(game.Resolve);
     for (var i = game.Resolve.ToString().Length; i < 10; i++)
     {
         Console.Write(" ");
     }
     if (game.DraculaAlly != null)
     {
         Console.Write(game.DraculaAlly.Event.Name().Substring(0, 3).ToUpper());
     }
     else
     {
         Console.Write("   ");
     }
     Console.Write("            ");
     if (game.HunterAlly != null)
     {
         Console.Write(game.HunterAlly.Event.Name().Substring(0, 3).ToUpper());
     }
     Console.WriteLine("");
     // line 3
     for (var i = 5; i >= 0; i--)
     {
         if (game.Dracula.Trail[i] != null && game.Dracula.Trail[i].DraculaCards.Count() > 1)
         {
             Console.ForegroundColor = game.Dracula.Trail[i].DraculaCards[1].Color;
             if (game.Dracula.Trail[i].DraculaCards[1].IsRevealed)
             {
                 Console.Write(game.Dracula.Trail[i].DraculaCards[1].Abbreviation + " ");
//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:Program.cs

示例9: LikelihoodOfHavingItemOfType_1UnknownItem_Returns5OutOf40

 public void LikelihoodOfHavingItemOfType_1UnknownItem_Returns5OutOf40()
 {
     GameState game = new GameState();
     vanHelsing.DrawItemCard();
     Assert.AreEqual( 5F / 40F, vanHelsing.LikelihoodOfHavingItemOfType(game, Item.Knife));
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:6,代码来源:HunterPlayerTests.cs

示例10: DraculaIsPlayingWildHorses

 /// <summary>
 /// Determines if Dracula is playing Wild Horses at the start of a combat
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Wild Horses</returns>
 private static bool DraculaIsPlayingWildHorses(GameState game, DecisionMaker logic)
 {
     if (logic.ChooseToPlayWildHorses(game))
     {
         Console.WriteLine("Dracula is playing Wild Horses to control your movement");
         game.Dracula.DiscardEvent(Event.WildHorses, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.WildHorses, Event.WildHorses, logic) > 0)
         {
             Console.WriteLine("Wild Horses cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:21,代码来源:Program.cs

示例11: DraculaLooksAtAllHuntersItems

 /// <summary>
 /// Handles the situation when a Hunter must reveal all Items to Dracula
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="victim">The Hunter revealing Items</param>
 private static void DraculaLooksAtAllHuntersItems(GameState game, HunterPlayer victim)
 {
     game.ItemDeck.AddRange(victim.ItemsKnownToDracula);
     victim.ItemsKnownToDracula.Clear();
     for (var i = 0; i < victim.ItemCount; i++)
     {
         Console.WriteLine("What is the name of the Item being revealed?");
         var itemRevealed = Item.None;
         while (itemRevealed == Item.None)
         {
             itemRevealed = Enumerations.GetItemFromString(Console.ReadLine());
         }
         AddItemCardToDraculaKnownCards(game, victim, itemRevealed);
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:20,代码来源:Program.cs

示例12: DiscardUnknownItemFromHunter

 /// <summary>
 ///     Asks the user to name an Item and then discards it from that Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunter">The Hunter discarding an Item</param>
 private static bool DiscardUnknownItemFromHunter(GameState game, HunterPlayer hunter)
 {
     Console.WriteLine("Name the Item being discarded (cancel to cancel)");
     var itemBeingDiscarded = Item.None;
     var line = "";
     while (itemBeingDiscarded == Item.None && line.ToLower() != "cancel")
     {
         line = Console.ReadLine();
         itemBeingDiscarded = Enumerations.GetItemFromString(line);
     }
     if (line.ToLower() != "cancel")
     {
         hunter.DiscardItem(game, itemBeingDiscarded);
         return true;
     }
     else
     {
         Console.WriteLine("No Item discarded");
         return false;
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:26,代码来源:Program.cs

示例13: DraculaIsPlayingSensationalistPressToPreventRevealingLocation

 /// <summary>
 /// Checks if Dracula is playing Sensationalist Press to prevent a Location card from being revealed
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="location">The Location being revealed</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Sensationalist Press</returns>
 private static bool DraculaIsPlayingSensationalistPressToPreventRevealingLocation(GameState game,
     Location location, DecisionMaker logic)
 {
     if (logic.ChooseToPlaySensationalistPress(game, location))
     {
         Console.WriteLine("Dracula is playing Sensationalist Press");
         game.Dracula.DiscardEvent(Event.SensationalistPress, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.SensationalistPress, Event.SensationalistPress, logic) > 0)
         {
             Console.WriteLine("Sensationalist Press cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:23,代码来源:Program.cs

示例14: UseHolyWaterOnHunter

 /// <summary>
 /// Resolves a Hunter using the Holy Water Item or the Holy Water font at St. Joseph & St. Mary
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterReceivingHolyWater">The Hunter receiving the Holy Water effect</param>
 private static void UseHolyWaterOnHunter(GameState game, Hunter hunterReceivingHolyWater)
 {
     if (hunterReceivingHolyWater == Hunter.MinaHarker)
     {
         Console.WriteLine("Mina's bite cannot be cured");
         return;
     }
     Console.WriteLine("Roll a die and enter the result");
     var dieRoll = 0;
     while (dieRoll == 0)
     {
         if (int.TryParse(Console.ReadLine(), out dieRoll))
         {
             if (dieRoll < 1 || dieRoll > 7)
             {
                 dieRoll = 0;
             }
         }
     }
     switch (dieRoll)
     {
         case 1:
             Console.WriteLine("{0} loses 2 health", hunterReceivingHolyWater.Name());
             game.Hunters[(int)hunterReceivingHolyWater].AdjustHealth(-2);
             CheckForHunterDeath(game); break;
         case 2:
         case 3:
         case 4:
             Console.WriteLine("Nothing happens"); break;
         case 5:
         case 6:
             Console.WriteLine("{0} is cured of a Bite", hunterReceivingHolyWater.Name());
             game.Hunters[(int)hunterReceivingHolyWater].AdjustBites(-1); break;
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:40,代码来源:Program.cs

示例15: UseHolyWaterAtHospital

 private static void UseHolyWaterAtHospital(GameState game, string hunterIndex)
 {
     var hunterUsingHolyWater = Hunter.Nobody;
     int index = -2;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterUsingHolyWater = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterUsingHolyWater == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is using the Holy Water font? {0}= {1}, {2}= {3}, {4}= {5}, {6}= {7} (-1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
             Hunter.MinaHarker.Name());
         line = Console.ReadLine();
         if (int.TryParse(line, out index))
         {
             if (index < -1 || index > 4)
             {
                 index = -2;
             }
             if (index == -1)
             {
                 Console.WriteLine("Cancelled");
                 return;
             }
             hunterUsingHolyWater = game.GetHunterFromInt(index);
             Console.WriteLine(hunterUsingHolyWater.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     UseHolyWaterOnHunter(game, hunterUsingHolyWater);
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:37,代码来源:Program.cs


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