Пример #1
0
        public Tile(TextureLibrary textureLibrary, Rectangle location)
        {
            _textureLibrary = textureLibrary;
            _location       = location;

            // Largest possible square inside hexagon has dimensions 0.634 * a, where a is the hexagon height & width
            // Give any object to be placed on this tile these (max) dimensions
            int objectDimensions = (int)Math.Floor(_location.Width * 0.634);
            int fromEdgePixels   = (_location.Width - objectDimensions) / 2;

            _objectLocation = new Rectangle(
                _location.X + fromEdgePixels,
                _location.Y + fromEdgePixels,
                objectDimensions,
                objectDimensions);
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            var textureLibrary  = new TextureLibrary(Content);
            var researchLibrary = new ResearchLibrary();

            var mapGenerator = new MapGenerator(textureLibrary, 14);
            Map gameMap      = mapGenerator.GenerateMap(25, 22);
            var players      = new List <Player>
            {
                new Player(new Britons(textureLibrary), TileColor.Blue, researchLibrary),
                new Player(new Britons(textureLibrary), TileColor.Red, researchLibrary)
            };

            _game = new Game(players, gameMap);
            _game.PlaceStartingTownCenters();
        }
Пример #3
0
 public Tower(TextureLibrary textureLibrary, Player owner) :
     base(textureLibrary, owner)
 {
 }
Пример #4
0
 public Britons(TextureLibrary textureLibrary) : base(textureLibrary)
 {
 }
Пример #5
0
 public VillagerFactory(TextureLibrary textureLibrary)
     : base(textureLibrary)
 {
     Type = typeof(Villager);
 }
Пример #6
0
 protected PlaceableObjectFactory(TextureLibrary textureLibrary)
 {
     TextureLibrary = textureLibrary;
     SetBaseStats();
 }
Пример #7
0
 public Blacksmith(TextureLibrary textureLibrary, Player owner) :
     base(textureLibrary, owner)
 {
 }
Пример #8
0
 protected Civilization(TextureLibrary textureLibrary)
 {
     TextureLibrary = textureLibrary;
 }
Пример #9
0
 public MapGenerator(TextureLibrary textureLibrary, int tileRelativeSize)
 {
     _textureLibrary = textureLibrary;
     _tileDimensions = tileRelativeSize * 4;
 }
Пример #10
0
 public Villager(TextureLibrary textureLibrary, Player owner) :
     base(textureLibrary, owner)
 {
 }
Пример #11
0
 public TownCenterFactory(TextureLibrary textureLibrary)
     : base(textureLibrary)
 {
     Type = typeof(TownCenter);
 }