Пример #1
0
 public void OnTurnEnd(ControllingUnit controllingUnit)
 {
     if (controllingUnit == ControllingUnit.Human)
     {
         mouse.Enabled = false;
     }
 }
Пример #2
0
        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");
            }
        }
Пример #3
0
 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>();
 }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
        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());
        }