Explicit function when starting and ending map generation as it happens over multiple frames.
parent
120d1dea7d
commit
c690f0f152
|
@ -69,6 +69,8 @@ public class TileWorld : Spatial
|
|||
|
||||
GenerateNoiseMap();
|
||||
// GenerateDebugMap();
|
||||
|
||||
OnHeightMapChanged();
|
||||
}
|
||||
|
||||
private void GenerateDebugMap()
|
||||
|
@ -92,11 +94,9 @@ public class TileWorld : Spatial
|
|||
}
|
||||
|
||||
Colormap.SetPixel(Size - 1, Size -1, new Color(1, 1, 1, 1));
|
||||
|
||||
Colormap.Unlock();
|
||||
_currentGenerationState = GenerationState.Done;;
|
||||
|
||||
EmitSignal("WorldGenerated");
|
||||
OnMapGenerationComplete();
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,9 +119,20 @@ public class TileWorld : Spatial
|
|||
_heightmapOffscreenTextureRect.Texture = heightmapTexture;
|
||||
Heightmap.CopyFrom(_heightmapOffscreenViewport.GetTexture().GetData());
|
||||
|
||||
OnHeightMapChanged();
|
||||
}
|
||||
|
||||
|
||||
private void OnHeightMapChanged()
|
||||
{
|
||||
_currentGenerationState = GenerationState.Heightmap;
|
||||
}
|
||||
|
||||
private void OnMapGenerationComplete()
|
||||
{
|
||||
_currentGenerationState = GenerationState.Done;
|
||||
EmitSignal("WorldGenerated");
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
|
@ -142,7 +153,7 @@ public class TileWorld : Spatial
|
|||
|
||||
_currentGenerationState = GenerationState.Done;
|
||||
|
||||
EmitSignal("WorldGenerated");
|
||||
OnMapGenerationComplete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue