RealWorldTerrainGenerateHeightmapsPhase.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* INFINITY CODE 2013-2019 */
  2. /* http://www.infinity-code.com */
  3. using InfinityCode.RealWorldTerrain.Generators;
  4. namespace InfinityCode.RealWorldTerrain.Phases
  5. {
  6. public class RealWorldTerrainGenerateHeightmapsPhase : RealWorldTerrainPhase
  7. {
  8. public override string title
  9. {
  10. get { return "Generate Heightmaps..."; }
  11. }
  12. public override void Enter()
  13. {
  14. if (index >= terrainCount)
  15. {
  16. Complete();
  17. return;
  18. }
  19. int x = index % prefs.terrainCount.x;
  20. int y = index / prefs.terrainCount.x;
  21. progress = (index + phaseProgress) / terrainCount;
  22. RealWorldTerrainElevationGenerator.GenerateHeightMap(terrains[x, y]);
  23. if (phaseComplete)
  24. {
  25. index++;
  26. phaseProgress = 0;
  27. phaseComplete = false;
  28. }
  29. }
  30. public override void Finish()
  31. {
  32. RealWorldTerrainElevationGenerator.tdataHeightmap = null;
  33. }
  34. public override void Start()
  35. {
  36. RealWorldTerrainElevationGenerator.tdataHeightmap = null;
  37. }
  38. }
  39. }