Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Game" /> class.
 /// </summary>
 public Game()
 {
     //engine = new GraphicEngine();
     mainWindow = new Window();
     map = new Map(new System.Windows.Point(25, 25));
     states = new Stack();
     players = new List<Player.IPlayer>();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the map.
        /// </summary>
        /// <param name="randomizer">The randomizer.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Unknow tile type</exception>
        public Map CreateMap(ISquareRandomizer randomizer)
        {
            Map map = new Map(new Point(25, 25));

            CivilizationAlgorithms.PerlinNoise.GenerateHeightMap(100, 25, 25);

            for (int i = 0; i < 25; ++i)
            {
                for (int j = 0; j < 25; ++j)
                {
                    Square.Square newSquare;
                    switch (CivilizationAlgorithms.PerlinNoise.GetTileType(i, j))
                    {
                        case ManagedTileType.Desert:
                            newSquare = new Desert();
                            break;
                        case ManagedTileType.Water:
                            newSquare = new Water();
                            break;
                        case ManagedTileType.Mountain:
                            newSquare = new Mountain();
                            break;
                        case ManagedTileType.Field:
                            newSquare = new Field();
                            break;
                        default:
                            throw new System.Exception("Unknow tile type");
                            break;
                    }

                    switch (CivilizationAlgorithms.PerlinNoise.GetDecoratorType(i, j))
                    {
                        case ManagedDecoratorType.Fruit :
                            newSquare = new FruitSquareDecorator(newSquare);
                            break;
                        case ManagedDecoratorType.Iron :
                            newSquare = new IronSquareDecorator(newSquare);
                            break;
                        default:
                            //NADA
                            break;
                    }

                    map.ReplaceSquare(new Point(i, j), newSquare);
                    map.GetSquare(new Point(i, j)).Position = new Point(i, j);
                }
            }

            CivilizationAlgorithms.PerlinNoise.FindIdealPositions();

            map.IdealPosition1 = new Point
            {
                X = CivilizationAlgorithms.PerlinNoise.GetIdealPosition1().X,
                Y = CivilizationAlgorithms.PerlinNoise.GetIdealPosition1().Y
            };

            map.IdealPosition2 = new Point
            {
                X = CivilizationAlgorithms.PerlinNoise.GetIdealPosition2().X,
                Y = CivilizationAlgorithms.PerlinNoise.GetIdealPosition2().Y
            };

            map.IdealPosition3 = new Point
            {
                X = CivilizationAlgorithms.PerlinNoise.GetIdealPosition3().X,
                Y = CivilizationAlgorithms.PerlinNoise.GetIdealPosition3().Y
            };

            return map;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicCity" /> class.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <param name="map">The map.</param>
        /// <param name="player">The player.</param>
        public BasicCity(Point location, Map map, Player.IPlayer player)
        {
            this.map = map;
            position = location;
            this.player = player;
            population = 1;
            ore = 0;
            food = 0;

            inDoorsUnits = new List<IUnit>();
            controlledCases = new List<Point>();
            controlledCases.Add(position);
        }
Exemplo n.º 4
0
 public City.ICity CreateCity(Point constructionPoint, Map map, IPlayer player)
 {
     return new City.BasicCity(constructionPoint, map, player);
 }