本文整理汇总了C#中Event.Name方法的典型用法代码示例。如果您正苦于以下问题:C# Event.Name方法的具体用法?C# Event.Name怎么用?C# Event.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event.Name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayDraculaAlly
/// <summary>
/// Resolves the situation when Dracula plays an Ally card
/// </summary>
/// <param name="game">The GameState</param>
/// <param name="eventPlayedByDracula">The Ally Event</param>
/// <param name="logic">The artificial intelligence component</param>
private static void PlayDraculaAlly(GameState game, Event eventPlayedByDracula, DecisionMaker logic)
{
Console.WriteLine("Dracula drew ally {0}", eventPlayedByDracula.Name());
Event allyToKeep;
if (game.DraculaAlly == null)
{
allyToKeep = eventPlayedByDracula;
}
else
{
game.EventDiscard.Add(game.DraculaAlly);
allyToKeep = logic.ChooseAllyToKeep(game, game.DraculaAlly.Event, eventPlayedByDracula);
}
game.DraculaAlly = game.EventDiscard.Find(card => card.Event == allyToKeep);
game.EventDiscard.Remove(game.DraculaAlly);
Console.WriteLine("{0} kept", allyToKeep.Name());
game.Dracula.EncounterHandSize = game.DraculaAlly.Event == Event.DraculasBrides ? 7 : 5;
game.Dracula.EventHandSize = game.DraculaAlly.Event == Event.ImmanuelHildesheim ? 6 : 4;
}
示例2: DraculaIsPlayingDevilishPowerToCancelEvent
/// <summary>
/// Determines if Dracula is playing Devilish Power to cancel an Event played by a Hunter
/// </summary>
/// <param name="game">The GameState</param>
/// <param name="eventBeingPlayedNow">The Event being played now</param>
/// <param name="eventInitiallyPlayed">The Event initially played at the beginning of this exchange</param>
/// <param name="logic">The artificial intelligence component</param>
/// <returns>True if Dracula successfully plays Devilish Power</returns>
private static bool DraculaIsPlayingDevilishPowerToCancelEvent(GameState game, Event eventBeingPlayedNow,
Event eventInitiallyPlayed, DecisionMaker logic, HunterPlayer hunterPlayingEvent)
{
if (logic.ChooseToCancelEventWithDevilishPower(game, eventBeingPlayedNow, eventInitiallyPlayed, hunterPlayingEvent))
{
Console.WriteLine("Dracula is playing Devilish Power to cancel {0}", eventBeingPlayedNow.Name());
game.Dracula.DiscardEvent(Event.DevilishPower, game.EventDiscard);
if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.DevilishPower, eventInitiallyPlayed, logic) > 0)
{
return false;
}
return true;
}
return false;
}
示例3: HunterPlayingGoodLuckToCancelDraculaEvent
/// <summary>
/// Determines if a Hunter is playing Good Luck to cancel an Event played by Dracula
/// </summary>
/// <param name="game">The GameState</param>
/// <param name="draculaEventBeingPlayed">The Event being played now</param>
/// <param name="eventInitiallyPlayed">The Event initially played at the beginning of this exchange</param>
/// <param name="logic">The artificial intelligence component</param>
/// <returns>An int corresponding to the Hunter playing Good Luck, 0 if none</returns>
private static int HunterPlayingGoodLuckToCancelDraculaEvent(GameState game, Event draculaEventBeingPlayed, Event eventInitiallyPlayed, DecisionMaker logic)
{
Console.WriteLine(
"Will anyone play Good Luck to cancel {0}? 0= Nobody, {1}= {2}, {3}= {4}, {5}= {6}, {7}= {8}",
draculaEventBeingPlayed.Name(), (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(),
(int)Hunter.DrSeward, Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(),
(int)Hunter.MinaHarker, Hunter.MinaHarker.Name());
var answer = -1;
while (answer == -1)
{
if (int.TryParse(Console.ReadLine(), out answer))
{
if (answer < 0 || answer > 4)
{
answer = -1;
}
}
}
if (answer > 0)
{
game.Hunters[answer].DiscardEvent(game, Event.GoodLuck);
if (DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.GoodLuck, eventInitiallyPlayed, logic, game.Hunters[answer]))
{
game.Dracula.DiscardEvent(Event.DevilishPower, game.EventDiscard);
return 0;
}
}
return answer;
}