Beispiel #1
0
 /// <summary>
 /// This function does the actual pairing of two cells. This function is required separately for the wrapped coordinate system,
 /// since there the two coordinates and the direction don't have a direct connection.
 /// </summary>
 /// <param name="currentCoordinates">This cells coordinates.</param>
 /// <param name="neighborCoordinates">The neighboring cell's coordinates.</param>
 /// <param name="toNeighbor">The direction towards the neighboring cell.</param>
 void PairCells(Vector2 currentCoordinates, Vector2 neighborCoordinates, CellDirection toNeighbor)
 {
     //Debug.Log(currentCoordinates);
     //Debug.Log(neighborCoordinates);
     GetCell(currentCoordinates).AddNeighbor(toNeighbor, GetCell(neighborCoordinates));
     GetCell(neighborCoordinates).AddNeighbor(toNeighbor.Opposite(), GetCell(currentCoordinates));
 }
 public void SetNeighbor(CellDirection direction, SquareCellScript cell)
 {
     neighbors[(int)direction] = cell;
     cell.neighbors[(int)direction.Opposite()] = this;
 }