Beispiel #1
0
        private void CreateUnits()
        {
            if (Gamers != null && Gamers.Length == 2)
            {
                PawnFactory pawnFac = new PawnFactory();
                for (int i = 0; i < BoardConsts.INITIAL_PAWNS; i++)
                {
                    APawn dPawn = pawnFac.Create(ECultures.DALRIONS);
                    dPawn.Position = new Coord(1 + i, 7);
                    Gamers[0].AddPawn(dPawn);

                    APawn rPawn = pawnFac.Create(ECultures.RAHKARS);
                    rPawn.Position = new Coord(BoardConsts.MAX_LIN - 2 - i, BoardConsts.MAX_COL - 8);
                    Gamers[1].AddPawn(rPawn);
                }

                CulturalCenterFactory centFac = new CulturalCenterFactory();
                ABuilding             dCenter = centFac.Create(ECultures.DALRIONS, Boards);
                ABuilding             rCenter = centFac.Create(ECultures.RAHKARS, Boards);

                Gamers[0].SetCultCenter((CulturalCenter)dCenter);
                Gamers[1].SetCultCenter((CulturalCenter)rCenter);
            }
            else
            {
                throw new ArgumentException("Invalid player array!");
            }
        }
        public APawn GeneratePawn(Board boards)
        {
            PawnFactory factory = new PawnFactory();
            APawn       pawn    = factory.Create(Culture);
            Coord       pos     = PlacementPosition(boards);

            if (pos == null)
            {
                UserUtils.PrintError("Can not generate more pawns!");
                return(null);
            }
            else
            {
                pawn.Position = pos;
                return(pawn);
            }
        }
Beispiel #3
0
 public StandardBoardBuilder(BoardTexturePack boardTextures, PieceTexturePack pieceTextures)
 {
     BoardTextures                 = boardTextures;
     PieceTextures                 = pieceTextures;
     WhitePawnFactory              = new PawnFactory(Alliance.White, pieceTextures.WhitePawn);
     WhiteKnightFactory            = new KnightFactory(Alliance.White, pieceTextures.WhiteKnight);
     WhiteBishopFactory            = new BishopFactory(Alliance.White, pieceTextures.WhiteBishop);
     WhiteRookFactory              = new RookFactory(Alliance.White, pieceTextures.WhiteRook);
     WhiteQueenFactory             = new QueenFactory(Alliance.White, pieceTextures.WhiteQueen);
     WhiteKingFactory              = new KingFactory(Alliance.White, pieceTextures.WhiteKing);
     BlackPawnFactory              = new PawnFactory(Alliance.Black, pieceTextures.BlackPawn);
     BlackKnightFactory            = new KnightFactory(Alliance.Black, pieceTextures.BlackKnight);
     BlackBishopFactory            = new BishopFactory(Alliance.Black, pieceTextures.BlackBishop);
     BlackRookFactory              = new RookFactory(Alliance.Black, pieceTextures.BlackRook);
     BlackQueenFactory             = new QueenFactory(Alliance.Black, pieceTextures.BlackQueen);
     BlackKingFactory              = new KingFactory(Alliance.Black, pieceTextures.BlackKing);
     BasicTileFactory              = new BasicTileFactory();
     WhitePawnPromotionTileFactory = new PawnPromotionTileFactory(Alliance.White, WhiteQueenFactory);
     BlackPawnPromotionTileFactory = new PawnPromotionTileFactory(Alliance.Black, BlackQueenFactory);
 }