Пример #1
0
 public AnimationInfo(Hex start, Hex end, HexagonContent content)
 {
     Start   = start;
     End     = end;
     Content = content;
     Turn    = 0;
 }
Пример #2
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;
                }
            }
        }
Пример #3
0
 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;
     }
 }
Пример #4
0
 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();
 }
Пример #5
0
 public Hexagon(Point hex, HexagonContent content)
 {
     this.hex     = new Hex(hex.X, hex.Y, (-1) * hex.X - hex.Y);
     currentColor = Color.White;
     Content      = content;
 }
Пример #6
0
 public Hexagon(Hex hex, HexagonContent type)
 {
     this.hex     = hex;
     currentColor = Color.White;
     this.Content = type;
 }