Esempio n. 1
0
 public override void ClearSprites()
 {
     if (cellLayers != null)
     {
         for (int i = cellLayers.Length - 1; i >= 0; i--)
         {
             TerrainCellLayer c = cellLayers[i];
             if (c)
             {
                 Destroy(c.gameObject);
             }
         }
     }
     if (altitudeCellLayer)
     {
         Destroy(altitudeCellLayer.gameObject);
     }
 }
Esempio n. 2
0
        public override void DrawSprites()
        {
            height = this.HexTerrain.HeightMap.GetHeight(X, Y);

            if (GetHeight == 0)
            {
                return;
            }

            cellLayers = new TerrainCellLayer[HexTerrain.TerrainLayers.Count];

            altitudeCellLayer = new GameObject(this.name + " altitudeCell").AddComponent <AltitudeCellLayer>();
            altitudeCellLayer.Init(this, HexTerrain.HeightMap);
            altitudeCellLayer.transform.parent        = this.transform;
            altitudeCellLayer.transform.localPosition = Vector3.zero;

            List <TerrainLayer> tlayers = HexTerrain.TerrainLayers;

            for (int i = tlayers.Count - 1; i >= 0; i--)
            {
                TerrainLayer     t         = tlayers[i];
                TerrainCellLayer cellLayer = new GameObject(this.name + " layer " + t.layerId).AddComponent <TerrainCellLayer>();
                cellLayers[i] = cellLayer;
                cellLayer.Init(this, t);
                cellLayer.transform.parent        = this.transform;
                cellLayer.transform.localPosition = Vector3.zero;
            }

            altitudeCellLayer.CreateSprites();

            for (int i = cellLayers.Length - 1; i >= 0; i--)
            {
                TerrainCellLayer c = cellLayers[i];
                c.CreateSprites();
                if (c.isActiveInLayer)
                {
                    if (c.autoTilingType != AutoTilingType.Contracting)
                    {
                        break;
                    }
                }
            }
        }