public void OnTurnEnd(ControllingUnit controllingUnit) { if (controllingUnit == ControllingUnit.Human) { mouse.Enabled = false; } }
public static string GetTextureName(this PieceType pieceType, ControllingUnit controllingUnit) { string postfix = (controllingUnit == ControllingUnit.AI) ? "_black" : ""; switch (pieceType) { case PieceType.Pawn: return("piece_pawn" + postfix); case PieceType.Knight: return("piece_knight" + postfix); case PieceType.Bishop: return("piece_bishop" + postfix); case PieceType.Rook: return("piece_tower" + postfix); case PieceType.Queen: return("piece_queen" + postfix); case PieceType.King: return("piece_king" + postfix); default: throw new ArgumentException("Invalid piece type"); } }
public Piece(PieceType pieceType, ControllingUnit controllingUnit, Node startNode) : base() { this.StartNode = startNode; this.ControllingUnit = controllingUnit; this.PieceType = pieceType; this.CurrentNode = startNode; PossibleMoves = new List <Node>(); }
public void OnTurnBegin(ControllingUnit controllingUnit) { Log.Message(string.Format("{0}'s turn", controllingUnit)); if (controllingUnit == ControllingUnit.AI) { } else if (controllingUnit == ControllingUnit.Human) { mouse.Enabled = true; } }
public void ChangeTurn(ControllingUnit controllingUnit) { if (CurrentController == controllingUnit) { Log.Warning(string.Format("'{0}' is already the current controller", controllingUnit)); return; } TurnCount[controllingUnit]++; MoveManager.OnTurnEnd(CurrentController); CurrentController = controllingUnit; TurnTime = TimeSpan.Zero; MoveManager.OnTurnBegin(controllingUnit); }
public void CreatePieces(ControllingUnit controllingUnit) { int yOffset = (controllingUnit == ControllingUnit.AI) ? 1 : 6; int firstColumn = (controllingUnit == ControllingUnit.AI) ? 0 : 7; for (int i = 0; i < NodeCountX; i++) { PieceDict[controllingUnit].Add(new Piece(PieceType.Pawn, controllingUnit, Nodes[i, yOffset])); } PieceDict[controllingUnit].Add(new Piece(PieceType.Knight, controllingUnit, Nodes[1, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.Knight, controllingUnit, Nodes[6, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.Bishop, controllingUnit, Nodes[2, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.Bishop, controllingUnit, Nodes[5, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.Rook, controllingUnit, Nodes[0, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.Rook, controllingUnit, Nodes[7, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.Queen, controllingUnit, Nodes[3, firstColumn])); PieceDict[controllingUnit].Add(new Piece(PieceType.King, controllingUnit, Nodes[4, firstColumn])); PieceDict[controllingUnit].ForEach(x => x.UpdatePossibleMoves()); }