示例#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);
 }
 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);
 }