Пример #1
0
        public Bridge GetNeighbor(int[] offset, LegacyBridgeLayer bridges)
        {
            if (offset == null)
            {
                return(null);
            }

            return(bridges.GetBridge(self.Location + new CVec(offset[0], offset[1])));
        }
Пример #2
0
 public void LinkNeighbouringBridges(World world, LegacyBridgeLayer bridges)
 {
     for (var d = 0; d <= 1; d++)
     {
         if (neighbours[d] != null)
         {
             continue;                     // Already linked by reverse lookup
         }
         var offset = d == 0 ? info.NorthOffset : info.SouthOffset;
         if (offset == null)
         {
             continue;                     // End piece type
         }
         neighbours[d] = GetNeighbor(offset, bridges);
         if (neighbours[d] != null)
         {
             neighbours[d].neighbours[1 - d] = this;                     // Save reverse lookup
         }
     }
 }