Example #1
0
			public void SetNeighbors (bool force=false)
			{
			UnityEngine.Profiling.Profiler.BeginSample("Set Neigs");
				TerrainGrid terrains = MapMagic.instance.terrains;

				Terrain newNeig_x = terrains.GetTerrain(coord.x-1, coord.z, onlyComplete:false);
				Terrain newNeig_Z = terrains.GetTerrain(coord.x, coord.z+1, onlyComplete:false);
				Terrain newNeig_X = terrains.GetTerrain(coord.x+1, coord.z, onlyComplete:false);
				Terrain newNeig_z = terrains.GetTerrain(coord.x, coord.z-1, onlyComplete:false);


				if (oldNeig_x != newNeig_x || oldNeig_Z != newNeig_Z || oldNeig_X != newNeig_X || oldNeig_z != newNeig_z || force)
				{
					terrain.SetNeighbors( newNeig_x, newNeig_Z, newNeig_X, newNeig_z );

					oldNeig_x = newNeig_x;  oldNeig_Z = newNeig_Z;  oldNeig_X = newNeig_X;  oldNeig_z = newNeig_z;
				}
			UnityEngine.Profiling.Profiler.EndSample();
			}