本文整理汇总了C#中Space.QuantityPlaced方法的典型用法代码示例。如果您正苦于以下问题:C# Space.QuantityPlaced方法的具体用法?C# Space.QuantityPlaced怎么用?C# Space.QuantityPlaced使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space.QuantityPlaced方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseAction
private DiceResult UseAction(Player player, Space space)
{
var result = new DiceResult(new int [0]);
switch (space.BoardSpace)
{
case BoardSpace.HuntingGrounds:
{
result = _dicePouch.Roll(space.QuantityPlaced(player));
var diceSum = result.Sum();
var numberOfFood = diceSum / 2;
player.PlayerBoard.Food += numberOfFood;
break;
}
case BoardSpace.Forest:
{
// TODO: be sure to test max on food track, population, tools, resources
result = _dicePouch.Roll(space.QuantityPlaced(player));
var diceSum = result.Sum();
var wholeResources = diceSum / (int)Resource.Wood;
Board.WoodAvailable -= wholeResources;
player.PlayerBoard.Resources[Resource.Wood] += wholeResources;
break;
}
case BoardSpace.ClayPit:
{
// TODO: be sure to test max on food track, population, tools, resources
result = _dicePouch.Roll(space.QuantityPlaced(player));
var diceSum = result.Sum();
var wholeResources = diceSum / (int)Resource.Brick;
Board.BrickAvailable -= wholeResources;
player.PlayerBoard.Resources[Resource.Brick] += wholeResources;
break;
}
case BoardSpace.Quarry:
{
// TODO: be sure to test max on food track, population, tools, resources
result = _dicePouch.Roll(space.QuantityPlaced(player));
var diceSum = result.Sum();
var wholeResources = diceSum / (int)Resource.Stone;
Board.StoneAvailable -= wholeResources;
player.PlayerBoard.Resources[Resource.Stone] += wholeResources;
break;
}
case BoardSpace.River:
{
// TODO: be sure to test max on food track, population, tools, resources
result = _dicePouch.Roll(space.QuantityPlaced(player));
var diceSum = result.Sum();
var wholeResources = diceSum / (int)Resource.Gold;
Board.GoldAvailable -= wholeResources;
player.PlayerBoard.Resources[Resource.Gold] += wholeResources;
break;
}
case BoardSpace.ToolMaker:
{
// TODO: be sure to test max on food track, population, tools, resources
var tools = player.PlayerBoard.Tools;
var minValue = tools.Min(t => t.Value);
var hasAToolFree = tools.Any(t => !t.Used);
for (int toolPosition = 0; toolPosition < tools.Length; toolPosition++)
{
if (hasAToolFree && tools[toolPosition].Used)
continue;
if (tools[toolPosition].Value == minValue)
{
tools[toolPosition] = Tool.ByValue(minValue + 1);
// TODO: remove tool from stack
// TODO: add tool back to stack when upgrading from 1/2 to 3/4
break;
}
}
break;
}
case BoardSpace.Hut:
{
// TODO: be sure to test max on food track, population, tools, resources
++player.PlayerBoard.PeopleToPlace;
++player.PlayerBoard.TotalPeople;
break;
}
case BoardSpace.Field:
{
// TODO: be sure to test max on food track, population, tools, resources
++player.PlayerBoard.FoodTrack;
break;
}
case BoardSpace.CivilizationCardSlot1:
{
player.PayingForSpace = BoardSpace.CivilizationCardSlot1;
break;
}
case BoardSpace.CivilizationCardSlot2:
{
player.PayingForSpace = BoardSpace.CivilizationCardSlot2;
break;
}
case BoardSpace.CivilizationCardSlot3:
//.........这里部分代码省略.........