本文整理汇总了C#中PlayerColor类的典型用法代码示例。如果您正苦于以下问题:C# PlayerColor类的具体用法?C# PlayerColor怎么用?C# PlayerColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerColor类属于命名空间,在下文中一共展示了PlayerColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllMovesForPlayer
public static IEnumerable<IMove> GetAllMovesForPlayer(GameBoard board, PlayerColor player)
{
IEnumerable<GameField> fields = board.GetFieldsByPlayer(player);
List<IMove> forcedMoves = new List<IMove>();
List<IMove> idleMoves = new List<IMove>();
bool forcedOnly;
foreach (GameField f in fields)
{
var moves = GetAllMovesFromField(board, f.Position, out forcedOnly);
if (forcedOnly) forcedMoves.AddRange(moves);
else idleMoves.AddRange(moves);
}
if (forcedMoves.Count > 0)
{
int longest = 0;
forcedMoves.ForEach(mv => { if (mv.Length > longest) longest = mv.Length; });
return forcedMoves.Where(mv => mv.Length == longest).ForEach<IMove, GameBoard>(SetMoveCaptures, board);
}
return idleMoves;
}
示例2: ChangeOutfit
void ChangeOutfit(PlayerColor color)
{
transform.FindChild("Change_Fx_Front").GetComponent<Animator>().SetTrigger("Change");
transform.FindChild("Change_Fx_Back").GetComponent<Animator>().SetTrigger("Change");
StartCoroutine(DelayToChange(color));
}
示例3: CreatePlayer
private static Player CreatePlayer(string name, PlayerColor color, Sex sex, int n)
{
var player = new Player(name, color, sex);
int i = 0;
StuffManager stuffManager = StuffManager.Instance;
foreach (IDxMCard dxMCard in stuffManager.DxMCards)
{
if (dxMCard is ICheatCard) continue;
if (dxMCard is IRaceCard && player.RaceCards.Count < 2)
player.RaceCards.Add((IRaceCard)dxMCard);
else if (dxMCard is IClassCard && player.ClassCards.Count < 2)
player.ClassCards.Add((IClassCard)dxMCard);
else if (dxMCard is IHalfBreededCard)
player.HalfBreededCard = (IHalfBreededCard)dxMCard;
else if (dxMCard is ISuperManchkinCard)
player.SuperManchkinCard = (ISuperManchkinCard)dxMCard;
else
player.HandCards.Add(dxMCard);
}
foreach (ITreasureCard treasureCard in stuffManager.TreasureCards)
{
ICheatCard cheatCard = i++ == 4 ? stuffManager.DxMCards.OfType<ICheatCard>().Single() : null;
player.WornItems.Add(Tuple.Create(treasureCard, cheatCard));
}
/*
for (int j = 0; j < n * 2; j++)
player.HandCards.Add(cardManager.TreasureCards.First());
*/
return player;
}
示例4: Piece
public Piece(PlayerColor playerColor, PieceType pieceType, byte x, byte y)
{
playerColorValue = playerColor;
pieceTypeValue = pieceType;
xValue = x;
yValue = y;
}
示例5: CheckForGameEnd
public static bool CheckForGameEnd(GameBoard board, out PlayerColor winner)
{
int whitePieces = board.GetPieceCountByOccupation(PlayerColor.White);
int blackPieces = board.GetPieceCountByOccupation(PlayerColor.Black);
if (whitePieces == 0)
{
winner = PlayerColor.Black;
return true;
}
else if (blackPieces == 0)
{
winner = PlayerColor.White;
return true;
}
else if (board.IdleMoves >= MAX_IDLE_MOVES)
{
if (whitePieces == blackPieces)
{
winner = PlayerColor.None;
return true;
}
winner = whitePieces > blackPieces ? PlayerColor.White : PlayerColor.Black;
return true;
}
winner = PlayerColor.None;
return false;
}
示例6: EndGameAction
public EndGameAction(System.IO.BinaryReader reader)
{
this.hasCheckmate = reader.ReadBoolean();
if (this.hasCheckmate)
this.looser = (PlayerColor)reader.ReadByte();
else
this.stalemateReason = (StalemateReason)reader.ReadByte();
}
示例7: Player
public Player(string name, int playerNumber, PlayerColor color, string textualRepresentation)
{
this.Pawns = new List<Pawn>(5);
this.Name = name;
this.PlayerNumber = playerNumber;
this.Color = color;
this.TextualRepresentation = textualRepresentation;
}
示例8: GetPlayer
public Player GetPlayer(PlayerColor color)
{
if (this.PlayerColor == color)
return new HumanPlayer();
//return new ComputerPlayer(AILevel.Hard);
return new ComputerPlayer(this.AILevel < AILevel.Easy ? AILevel.Medium : this.AILevel);
}
示例9: Piece
public Piece(PlayerColor couleur, String nom)
{
if (couleur == PlayerColor.White)
this.nom = nom + "B";
else
this.nom = nom + "N";
this.couleur = couleur;
}
示例10: WinBoard
public WinBoard(PlayerColor color, AILevel aiLevel, string startFen, string engine)
{
this.color = color;
this.AILevel = aiLevel;
this.startFen = startFen;
var psi = new ProcessStartInfo { UseShellExecute = false, CreateNoWindow = true, FileName = "engines\\polyglot", Arguments = "engines\\" + engine + ".ini", RedirectStandardInput = true, RedirectStandardOutput = true };
this.process = Process.Start(psi);
this.output = this.process.StandardOutput;
this.input = this.process.StandardInput;
}
示例11: DrawSquare
private static Image DrawSquare(SquareColor color, PlayerColor player = 0, Type piece = null)
{
var image = new Bitmap(100, 100);
using (var g = Graphics.FromImage(image))
{
g.FillRectangle(new SolidBrush(color.ToColor()), 0, 0, 100, 100);
if (piece != null)
g.DrawImage(Images.GetPieceImage(player, piece), 0, 0, 100, 100);
}
return image;
}
示例12: PlayerDied
//
public void PlayerDied(PlayerColor color)
{
foreach(var startingPosObj in this.StartingPositions.transform)
{
var startingPos = ((Transform)startingPosObj).GetComponent<StartingPosition>();
if (startingPos.IsActive && startingPos.PlayerColor == color)
{
StartCoroutine( startingPos.SpawnPlayer() );
break;
}
}
}
示例13: Player
public Player(PlayerColor color, RaceName race, bool isHuman)
{
Color = color;
Race = race;
Money = 70;
TimeLeft = 30 * 25;
MaxTurnTime = 30 * 25;
UnitCount = 0;
StationCount = 0;
IsHuman = isHuman;
Strategy = new HumanStrategy();
}
示例14: AddPlayer
private void AddPlayer(string playerTokenUrl, PlayerColor playerColor)
{
NumberOfPlayers++;
var player = new Player
{
Name = string.Format("Player {0}", NumberOfPlayers),
ImageUri = new Uri(playerTokenUrl),
TurnOrder = NumberOfPlayers,
GameTokenColor = playerColor
};
PlayerList.Add(player);
}
示例15: Start
// Use this for initialization
void Start()
{
var kvp = PlayerManager.Instance.GetPlayerFor( this.MatchupForPlayers );
if (kvp.HasValue)
{
this.IsActive = true;
this.PlayerColor = kvp.Value.Key;
this.playerActions = kvp.Value.Value;
StartCoroutine( this.SpawnPlayer() );
}
}