public void MoveCompoundHexagonToSide(CompoundHexagon compoundHexagon,
                                              Vector3Int v3, int side)
        {
            // find current location
            CompoundHexagon current = (CompoundHexagon)this.GetHexagon(v3);

            Console.WriteLine("found hex " + current.ToString() + " at " + v3);
            for (int i = current.GetNumberOfHexes() - 1; i >= 0; i--)
            {
                Vector3Int v = new Vector3Int(current.GetHexagon(i).GetVector().x, current.GetHexagon(i).GetVector().y, current.GetHexagon(i).GetVector().z);
                v += COMPOUND_NEIGHBORS[side];
                compoundHexagon.GetHexagon(i).SetCoordinates(v);
            }
        }
Example #2
0
 /// <summary>
 /// Assigns the values of another <see cref="CompoundHexagon"/> to this one.
 /// </summary>
 /// <param name="hex">the other <see cref="CompoundHexagon"/></param>
 public void CopyOf(CompoundHexagon hex)
 {
     ((Hexagon)this).CopyOf(hex);
     Rotations = hex.Rotations;
     hexes     = new Hexagon[hex.hexes.Length];
     for (int i = 0, len = hexes.Length; i < len; i++)
     {
         Hexagon h = new Hexagon(
             hex.hexes[i].IsFlat(),
             hex.hexes[i].Id,
             hex.hexes[i].GetSize()
             );
         h.CopyOf(hex.hexes[i]);
         hexes[i] = h;
         h        = null;
     }
 }