Ejemplo n.º 1
0
        public void Move(Cell source, Cell destination)
        {
            if (!source.IsOccupied() || !_gameMover.GetValidMoves(source).Contains(destination))
                return;

            if (destination.GetState() == Cell.State.Empty)
                destination.SetPiece(source.GetPiece());
            else
            {
                int winner = Attack((int) source.GetPieceRank(), (int) destination.GetPieceRank());
                if (winner == 1)
                    destination.SetPiece(source.GetPiece());
                if (winner == 0)
                    destination.RemovePiece();
            }
            source.RemovePiece();
        }
Ejemplo n.º 2
0
 public void CellCanGetPieceRank()
 {
     var cell = new Cell("Test");
     var piece = new Piece("Blue", Army.Rank.Bomb);
     cell.SetPiece(piece);
     Army.Rank? cellPieceRank = cell.GetPieceRank();
     Assert.AreEqual(Army.Rank.Bomb, cellPieceRank);
 }