本文整理汇总了C#中IPlayer类的典型用法代码示例。如果您正苦于以下问题:C# IPlayer类的具体用法?C# IPlayer怎么用?C# IPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPlayer类属于命名空间,在下文中一共展示了IPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public ISpecialEventResult Execute(IPlayer player)
{
var result = SpecialEventResult.Create();
var firstDice = Dice.Throw();
var secondDice = Dice.Throw();
result.Dices.Add(firstDice);
result.Dices.Add(secondDice);
result.Success = IsMagicLessThanTwoDices(firstDice, secondDice, player);
if (result.Success)
{
var position = player.Game.Board.GoFromInnerToMiddle();
result.Player = player.SetPosition(position);
}
else
{
CommandHelper.RemoveOnePointOfLife(player);
}
result.Message =
"Aby przeby� Trz�sawiska musisz u�y� Magii. Rzu� dwoma kostkami: wynik mniejszy lub r�wny twojej Magii - przeprawi�e� si� na drug� stron�." +
" Wi�kszy wynik oznacza pora�k� (tracisz 1 �ycie). Nie mo�esz kontynuowa� podr�y dop�ki nie przejdziesz przez Trz�sawiska.";
return result;
}
示例2: ChessEngine
public ChessEngine( IBoard board, IPlayer white, IPlayer black, ConfigChess config )
{
this.board = board;
this.white = white;
this.black = black;
this.config = config;
}
示例3: Execute
public ISpecialEventResult Execute(IPlayer player)
{
var result = SpecialEventResult.Create();
result.Success = true;
var dice = Dice.Throw();
result.Dices.Add(dice);
switch (dice)
{
case 1:
case 2:
CommandHelper.RemoveOnePointOfMight(player);
break;
case 3:
case 4:
CommandHelper.AddOnePointOfMight(player);
break;
case 5:
CommandHelper.AddOnePointOfMagic(player);
break;
}
result.Message =
"Rzuæ kostk¹ 1,2 - tracisz 1 punkt Miecza; 3,4 - zyskujesz 1 punkt Miecza; 5 - zyskujesz 1 punkt Magii; 6 - zosta³eœ zignorowany.";
return result;
}
示例4: GetDesirablity
public double GetDesirablity(IPlayer attacker, IHexa hexa)
{
if (map.GetPlayerOthers().Count == 0)
return 0.0f;
if (hexa.GetCapturedIPlayer() == attacker)
return 0.0f;
int enemySum = 0;
int attackerSum = hexa.GetNormalProductivity(attacker);
foreach (IPlayer player in map.GetPlayerOthers())
{
if (player == attacker)
{
enemySum += hexa.GetNormalProductivity(map.GetPlayerMe());
}
else
enemySum += hexa.GetNormalProductivity(player);
}
if (hexa.GetCaptured() && hexa.GetCapturedIPlayer() != attacker)
{
return (enemySum + attackerSum) / 144.0f;
}
return (enemySum) / 144.0f;
}
示例5: PlacePlayerInScoreBoard
/// <summary>
/// Puts current player in score board. Determines position comparing player's scores with other entries in score board.
/// </summary>
/// <param name="player">Current players that plays the game.</param>
public void PlacePlayerInScoreBoard(IPlayer player)
{
this.LoadTopPlayers(Globals.BestScoresPath);
int emptyPosition = this.GetFirstFreePosition();
if (this.scoreBoardTable.TopPlayers[emptyPosition] == null || player.Score >= this.scoreBoardTable.TopPlayers[emptyPosition].Score)
{
this.scoreBoardTable.TopPlayers[emptyPosition] = player;
for (int i = 0; i < emptyPosition; i++)
{
IPlayer firstPlayer = this.scoreBoardTable.TopPlayers[i];
IPlayer secondPlayer = this.scoreBoardTable.TopPlayers[i + 1];
if (firstPlayer.Score < secondPlayer.Score)
{
this.scoreBoardTable.TopPlayers[i] = secondPlayer;
this.scoreBoardTable.TopPlayers[i + 1] = firstPlayer;
}
}
}
this.export = new FileExporter(this.scoreBoardTable);
this.export.Save(Globals.BestScoresPath);
}
示例6: Execute
public ISpecialEventResult Execute(IPlayer player)
{
var result = SpecialEventResult.Create();
var dice = Dice.Throw();
result.Success = true;
result.Dices.Add(dice);
switch (dice)
{
case 1:
var straznik = StandardCreature.New("Stra¿nik Krêgu", 5);
var fightResult = straznik.Fight(player);
result.Success = fightResult.Success;
result.Dices.Add(fightResult.PlayerDice);
result.Dices.Add(fightResult.CreatureDice);
break;
case 2:
case 3:
CommandHelper.WaitOneTurn(player);
break;
case 6:
CommandHelper.AddOnePointOfMagic(player);
break;
}
result.Message =
"Musisz rzuciæ kostk¹: 1 - zosta³eœ zaatakowany przez Stra¿nika Krêgu (Miecz 5);" +
" 2, 3 - tracisz 1 ture; 4, 5 - nic siê nie dzieje; 6 - zyskujesz 1 punkt Magii.";
return result;
}
示例7: MovePlayer
private void MovePlayer(IPlayer player, int rollValue)
{
if (player.Location + rollValue > board.Locations.Count())
player.Location = (player.Location + rollValue) % board.Locations.Count();
else
player.Location += rollValue;
}
示例8: RaiseAction
public RaiseAction(IPlayer player, int raiseAmount, List<IPlayer> players, int playerIndex)
: base(player, Actions.Raise)
{
this.RaiseAmount = raiseAmount;
this.Players = players;
this.PlayerIndex = playerIndex;
}
示例9: MastAdapter
public MastAdapter(IPlayer player)
{
if (player == null) throw new NullReferenceException("Player cannot be null.");
if (!(player is FrameworkElement)) throw new NullReferenceException("Player must be a FrameworkElement.");
this.player = player;
HookPlayerEvents();
}
示例10: Main
static void Main(string[] args)
{
Console.Title = "TicTacToe";
var players = new IPlayer[] { new HumanConsolePlayer(), new AlphaBetaMinimaxPlayer() };
int current = 0;
var alternante = 0;
Grid g = Grid.Empty;
while (true)
{
g = players[current].MakeMove(g);
current = (current + 1) % 2;
if (g.IsFinished)
{
ConsoleGridRenderer.Render(g);
if (!g.IsDraw)
Console.WriteLine("{0} win!", g.CurrentIsO ? "X" : "O");
else
Console.WriteLine("Draw!");
current = (++alternante % 2);
g = Grid.Empty;
}
Console.WriteLine("\n");
}
}
示例11: PlayerPositionPacket
public PlayerPositionPacket(IPlayer player)
{
PlayerId = player.Id;
X = player.Position.X;
Y = player.Position.Y;
Z = 0f;
}
示例12: GetDescription
private static string GetDescription(IPlayer player, uint numberOfCards)
{
if (numberOfCards == 1)
return string.Format("{0} draws 1 card", player.Name);
else
return string.Format("{0} draws {1} cards", player.Name, numberOfCards);
}
示例13: GenerateGrid
/// <summary>
/// Generete game field
/// </summary>
/// <param name="grid">Field member</param>
/// <param name="player"Player member></param>
/// <returns>Genereted game filed</returns>
public IGrid GenerateGrid(IPlayer player, IGrid grid)
{
DefaultRandomGenerator random = DefaultRandomGenerator.Instance();
int percentageOfBlockedCells = random.Next(GlobalConstants.MinimumPercentageOfBlockedCells, GlobalConstants.MaximumPercentageOfBlockedCells);
for (int row = 0; row < grid.TotalRows; row++)
{
for (int col = 0; col < grid.TotalCols; col++)
{
int num = random.Next(0, 100);
if (num < percentageOfBlockedCells)
{
grid.SetCell(row, col, GlobalConstants.BlockedCellSymbol);
}
else
{
grid.SetCell(row, col, GlobalConstants.FreeCellSymbol);
}
}
}
grid.SetCell(grid.TotalRows / 2, grid.TotalCols / 2, GlobalConstants.PlayerSignSymbol);
this.MakeAtLeastOneExitReachable(grid, player);
return grid;
}
示例14: Game
public Game(IPlayer player, DelegateCreateRaceLineup createRaceLineup, DelegateAggregateSnails aggregateSnails, IBookie bookie)
{
this.player = player;
this.createRaceLineup = createRaceLineup;
this.aggregateSnails = aggregateSnails;
this.bookie = bookie;
}
示例15: Start
// Use this for initialization
void Start()
{
lightning = GetComponent<Lightning>();
lightning.enabled = false;
player = GetComponent<IPlayer>();
lightning.maxLength = 200f;
}