Esempio n. 1
0
        public TerrainSurrogate(Terrain terrain)
        {
            TerrainData terrainData = terrain.terrainData;

            this.width       = terrainData.heightmapWidth;
            this.height      = terrainData.heightmapHeight;
            this.terrainSize = new Vector3Surrogate(terrainData.size);

            float[,] heights = terrainData.GetHeights(0, 0, terrainData.heightmapWidth, terrainData.heightmapHeight);

            this.heightData = new float[terrainData.heightmapWidth * terrainData.heightmapHeight];

            int i = 0;

            for (int x = 0; x < terrainData.heightmapWidth; x++)
            {
                for (int y = 0; y < terrainData.heightmapHeight; y++)
                {
                    this.heightData[i++] = heights[x, y];
                }
            }
            //heightData = heights.Cast<float>().ToArray();
        }
Esempio n. 2
0
 public TransformSurrogate(Transform transform)
 {
     this.position = new Vector3Surrogate(transform.position);
     this.rotation = new QuaternionSurrogate(transform.rotation);
     this.scale    = new Vector3Surrogate(transform.localScale);
 }