public static SegmentNeighbourhoodDiregment Opposite(this SegmentNeighbourhoodDiregment diregment)
 {
     if (diregment == SegmentNeighbourhoodDiregment.Bottom)
     {
         return(SegmentNeighbourhoodDiregment.Top);
     }
     else if (diregment == SegmentNeighbourhoodDiregment.Left)
     {
         return(SegmentNeighbourhoodDiregment.Right);
     }
     else if (diregment == SegmentNeighbourhoodDiregment.Right)
     {
         return(SegmentNeighbourhoodDiregment.Left);
     }
     else if (diregment == SegmentNeighbourhoodDiregment.Top)
     {
         return(SegmentNeighbourhoodDiregment.Bottom);
     }
     else
     {
         Preconditions.Fail($"Not supported diregment {diregment}");
         return(SegmentNeighbourhoodDiregment.Bottom);
     }
 }
Exemple #2
0
 private bool NeighbourHasAdjacentSegment(SegmentSlotState neighbour, IntVector2 newSegmentPosition,
                                          SegmentNeighbourhoodDiregment diregment)
 {
     return(neighbour.HasSegment && neighbour.SegmentPosition.Equals(newSegmentPosition + diregment.Movement));
 }
Exemple #3
0
 public ModuloPosition GetNeighbourPosition(SegmentNeighbourhoodDiregment diregment)
 {
     return(new ModuloPosition(_slotMapSize, _moduledPosition + diregment.Movement));
 }