コード例 #1
0
 public virtual void setAdjacentHex(HexEdgeEnum edge, MapHex hex)
 {
     if (hex == this)
     {
         throw new Exception("A map hex can't be set adjacent to itself.");
     }
 }
コード例 #2
0
ファイル: WorldMap.cs プロジェクト: Krosantos/4xAnimals
 private void addNeighbours(MapHex input, List<MapHex> targetList, List<MapHex> blackList, List<MapHex> proofList)
 {
     foreach(GameObject Hex in input.neighborList){
         if(!blackList.Contains(Hex.GetComponent<MapHex>()) && proofList.Contains(Hex.GetComponent<MapHex>())){
             targetList.Add (Hex.GetComponent<MapHex>());
             Hex.GetComponent<MapHex>().contIndex = input.contIndex;
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Loops thru all the hexes 'hiding' the complexity
        /// </summary>
        /// <param name="callback"></param>
        public void AllHexesInMapCoords(OnMapHex callback)
        {
            for (int r = 0; r < MapHeight; r++)
            {
                //int r_offset = (int) Math.Floor( (double) (r / 2)); // or r>>1
                int r_offset = GetRowOffset(r);

                for (int q = -r_offset; q < MapWidth - r_offset; q++)
                {
                    Point  p      = new Point(r, q);
                    MapHex maphex = new MapHex(map[p], r, q + r_offset);
                    callback(maphex);
                }
            }
        }
コード例 #4
0
 public override void setAdjacentHex(HexEdgeEnum edge, MapHex hex)
 {
     Debug.LogWarning("Called setAdjacentHex for ImmutableMapHex");
 }