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();
|
GenerateNoiseMap();
|
||||||
// GenerateDebugMap();
|
// GenerateDebugMap();
|
||||||
|
|
||||||
|
OnHeightMapChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateDebugMap()
|
private void GenerateDebugMap()
|
||||||
|
@ -92,11 +94,9 @@ public class TileWorld : Spatial
|
||||||
}
|
}
|
||||||
|
|
||||||
Colormap.SetPixel(Size - 1, Size -1, new Color(1, 1, 1, 1));
|
Colormap.SetPixel(Size - 1, Size -1, new Color(1, 1, 1, 1));
|
||||||
|
|
||||||
Colormap.Unlock();
|
Colormap.Unlock();
|
||||||
_currentGenerationState = GenerationState.Done;;
|
|
||||||
|
|
||||||
EmitSignal("WorldGenerated");
|
OnMapGenerationComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,9 +119,20 @@ public class TileWorld : Spatial
|
||||||
_heightmapOffscreenTextureRect.Texture = heightmapTexture;
|
_heightmapOffscreenTextureRect.Texture = heightmapTexture;
|
||||||
Heightmap.CopyFrom(_heightmapOffscreenViewport.GetTexture().GetData());
|
Heightmap.CopyFrom(_heightmapOffscreenViewport.GetTexture().GetData());
|
||||||
|
|
||||||
|
OnHeightMapChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void OnHeightMapChanged()
|
||||||
|
{
|
||||||
_currentGenerationState = GenerationState.Heightmap;
|
_currentGenerationState = GenerationState.Heightmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnMapGenerationComplete()
|
||||||
|
{
|
||||||
|
_currentGenerationState = GenerationState.Done;
|
||||||
|
EmitSignal("WorldGenerated");
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Process(float delta)
|
public override void _Process(float delta)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +153,7 @@ public class TileWorld : Spatial
|
||||||
|
|
||||||
_currentGenerationState = GenerationState.Done;
|
_currentGenerationState = GenerationState.Done;
|
||||||
|
|
||||||
EmitSignal("WorldGenerated");
|
OnMapGenerationComplete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue