public AnimationInfo(Hex start, Hex end, HexagonContent content) { Start = start; End = end; Content = content; Turn = 0; }
public void FieldCell(Hex hex) { Hexagon h = GetHex(hex); if (h.Type == HexagonType.Empty) { if (h.S == mapRadius || h.R == -mapRadius) { SetHexInfo(hex, new HexagonContent((HexagonElement)rand.Next(maxValue))); animator.AddAnimation(new AnimationInfo(Hex.Neighbor(hex, 2), hex, h.Content)); } else { HexagonContent hexContent = HexagonContent.Empty; for (int i = 0; i < 3; i++) { Hexagon tempHex = GetHex(Hex.Neighbor(hex, ((i + 1) % 3) + 1));//get hex in order : up -> left-up -> right-up if (tempHex != null && tempHex.Type != HexagonType.Block && !tempHex.Content.Frozen && !h.HaveWall(((i + 1) % 3) + 1)) { hexContent = tempHex.Content; // animator.AddAnimation(new AnimationInfo(tempHex.Hex, hex, hexContent)); // tempHex.Content = HexagonContent.Empty; FieldCell(tempHex.Hex); break; } } h.Content = hexContent; } } }
public void SetHexInfo(Hex hex, HexagonContent info) { if (Math.Abs(hex.q) <= mapRadius && Math.Abs(hex.r) <= mapRadius) { hexMap[hex.q + mapRadius, hex.r + mapRadius].Content = info; } }
public FallAnimation(GridAnimator parant, Vector2 startPosition, Vector2 endPosition, HexagonContent content, Hex endHex) { this.parant = parant; this.startPosition = startPosition; this.endPosition = endPosition; this.content = content; end = endHex; currentPosition = startPosition; direction = endPosition - startPosition; direction.Normalize(); }
public Hexagon(Point hex, HexagonContent content) { this.hex = new Hex(hex.X, hex.Y, (-1) * hex.X - hex.Y); currentColor = Color.White; Content = content; }
public Hexagon(Hex hex, HexagonContent type) { this.hex = hex; currentColor = Color.White; this.Content = type; }