示例#1
0
 public Bridge GetNeighbor(int[] offset, BridgeLayer bridges)
 {
     if (offset == null)
     {
         return(null);
     }
     return(bridges.GetBridge(self.Location + new CVec(offset[0], offset[1])));
 }
示例#2
0
 public void LinkNeighbouringBridges(World world, BridgeLayer bridges)
 {
     // go looking for our neighbors if this is a long bridge.
     if (Info.NorthOffset != null)
     {
         northNeighbour = GetNeighbor(Info.NorthOffset, bridges);
     }
     if (Info.SouthOffset != null)
     {
         southNeighbour = GetNeighbor(Info.SouthOffset, bridges);
     }
 }
示例#3
0
文件: Bridge.cs 项目: wytsep/OpenRA
 public void LinkNeighbouringBridges(World world, BridgeLayer 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
         }
     }
 }