Esempio n. 1
0
				public void OnMove (Coord oldCoord, Coord newCoord) 
				{
					worker.Stop();
					results.Clear();
					//terrain.gameObject.SetActive(false); //enabling/disabling is now in update control
					terrain.transform.localPosition = coord.ToVector3(MapMagic.instance.terrainSize);
					
					//clearing pools
					Rect terrainRect = new Rect(oldCoord.x*MapMagic.instance.terrainSize, oldCoord.z*MapMagic.instance.terrainSize, MapMagic.instance.terrainSize, MapMagic.instance.terrainSize);
						//using oldCoords because instances are bound to old coordinates
					MapMagic.instance.objectsPool.ClearAllRect(terrainRect);

				//	foreach (KeyValuePair<Transform,ObjectPool> kvp in MapMagic.pools)
				//		kvp.Value.ClearAllRect(terrainRect);
				}
Esempio n. 2
0
				public void OnMove (Coord oldCoord, Coord newCoord) 
				{
					worker.Stop();
					results.Clear();
					if (terrain != null) //it could be destroyed by undo
					{
						if (terrain.materialTemplate != null) GameObject.DestroyImmediate(terrain.materialTemplate); //removes custom shader textures as well. Unity does not remove them!
						Resources.UnloadUnusedAssets();
					}
					
					terrain.transform.localPosition = coord.ToVector3(MapMagic.instance.terrainSize);
					
					//clearing pools
					Rect terrainRect = new Rect(oldCoord.x*MapMagic.instance.terrainSize, oldCoord.z*MapMagic.instance.terrainSize, MapMagic.instance.terrainSize, MapMagic.instance.terrainSize);
						//using oldCoords because instances are bound to old coordinates
					MapMagic.instance.objectsPool.ClearAllRect(terrainRect);

				//	foreach (KeyValuePair<Transform,ObjectPool> kvp in MapMagic.pools)
				//		kvp.Value.ClearAllRect(terrainRect);
				}