Ejemplo n.º 1
0
        public HexDefinition CreateHexDefinition(string hexName, Point hexPosition)
        {
            var rectangle = new RectangleInt(hexPosition.X, hexPosition.Y, this.HexSize.Width, this.HexSize.Height);
            var hexDefinition = new HexDefinition(this, hexName, rectangle);

            this.Definitions.Add(hexName, hexDefinition);
            return hexDefinition;
        }
Ejemplo n.º 2
0
 public virtual void Draw(IDrawContext drawContext, HexDefinition hexDefinition, Rectangle destination)
 {
     drawContext.DrawImage(new DrawImageParams
     {
         Texture = this.Texture,
         Source = hexDefinition.Rectangle,
         Destination = destination,
     });
 }
Ejemplo n.º 3
0
        public HexLayer(string name, Size mapSize, Size hexSize, int topEdgeLength, HexDefinition defaultHexDefinition = null)
            : base(name)
        {
            this.MapSize = mapSize;
            this.HexSize = hexSize;
            this.topEdgeLength = topEdgeLength;

            this.map = new HexDefinition[mapSize.Width, mapSize.Height];
            if (defaultHexDefinition == null)
                defaultHexDefinition = NullHexDefinition.CreateInstance();

            for (var i = 0; i < mapSize.Width; i++)
                for (var j = 0; j < mapSize.Height; j++)
                {
                    this.map[i, j] = defaultHexDefinition;
                }
        }
Ejemplo n.º 4
0
 public override void Draw(IDrawContext drawContext, HexDefinition hexDefinition, Rectangle destination)
 {
     // Do nothing NullObjectPattern
 }
Ejemplo n.º 5
0
 public void AddHexDefinition(HexDefinition hexDefinition)
 {
     this.Definitions.Add(hexDefinition.Name, hexDefinition);
 }
Ejemplo n.º 6
0
 private static object GetHexDefinitionXml(HexDefinition hexDefinition)
 {
     return new XElement("HexDefinition",
         new XAttribute("name", hexDefinition.Name),
         new XAttribute("rectangle", hexDefinition.Rectangle));
 }