Exemplo n.º 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!");
            }
        }
Exemplo n.º 2
0
        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);
            }
        }