Example #1
0
 public HexCell this[int x, int y]
 {
     get
     {
         //return WorldMap[y + Radius, x + Radius + Mathf.Min(0, y)];
         Coords c = new Coords(x, y);
         if (WorldMap.ContainsKey(c))
         {
             return(WorldMap[c]);
         }
         //Debug.LogWarning("Map::this[int x, int y] - No HexCell in Map for these coords: " + c.ToString());
         return(null);
     }
     set
     {
         //WorldMap[y + Radius, x + Radius + Mathf.Min(0, y)] = value;
         Coords c = new Coords(x, y);
         if (WorldMap.ContainsKey(c))
         {
             WorldMap[c] = value;
         }
         else
         {
             WorldMap.Add(c, value);
         }
     }
 }
Example #2
0
 public HexCell this[Coords coord]
 {
     get
     {
         if (WorldMap.ContainsKey(coord))
         {
             return(WorldMap[coord]);
         }
         //Debug.LogWarning("Map::this[Coords coord] - No HexCell in Map for these coords: " + coord.ToString());
         return(null);
     }
     set
     {
         if (WorldMap.ContainsKey(coord))
         {
             WorldMap[coord] = value;
         }
         else
         {
             WorldMap.Add(coord, value);
         }
     }
 }