Ejemplo n.º 1
0
        private ITile[,] GenerateTiles(BuildingCellViewModel[,] buildingCells)
        {
            var result = new ITile[buildingCells.GetUpperBound(0)+1,buildingCells.GetUpperBound(1)+1];

            for(int x=0;x<=buildingCells.GetUpperBound(0); x++)
            {
                for(int y=0;y<=buildingCells.GetUpperBound(1); y++)
                {
                    result[x, y] = new BuildingCellTile(_content, _spritebatch,buildingCells[x, y]);
                }
            }

            return result;
        }
Ejemplo n.º 2
0
 public BuildingCellTile(ContentController content, SpriteBatch spritebatch, BuildingCellViewModel buildingCell)
 {
     _spritebatch = spritebatch;
     _buildingCell = buildingCell;
     _testTexture = content.GetContent<Texture2D>("StarFields/test");
     _testTexture2 = content.GetContent<Texture2D>("SystemMap/Planet1");
 }
Ejemplo n.º 3
0
        private Vector2 CalculateBuildingCellOffset(BuildingCellViewModel[,] cells)
        {
            var totalWidth = (cells.GetUpperBound(0)+1) * BuildingCellSize;
            var totalHeight = (cells.GetUpperBound(1)+1) * BuildingCellSize;
            var centerPoint = new Rectangle(0,0, (int)ActualWidth, (int)ActualHeight).Center;

            var offset = new Vector2(centerPoint.X, centerPoint.Y) - (new Vector2(totalWidth, totalHeight)/2);

            return offset;
        }