Fixed wrong tile type texture when generating new level.
parent
453cfcde00
commit
593c2f556b
|
@ -297,15 +297,6 @@ public class World : Spatial {
|
|||
// set new center chunk
|
||||
CenterChunkIndex = GetChunkTupleFromPlaneCoord(planeCoord);
|
||||
|
||||
WorldChunk currentChunk = GetOrCreateWorldChunk(CenterChunkIndex,
|
||||
new Color(GD.Randf(), GD.Randf(), GD.Randf()));
|
||||
|
||||
_centerChunkRect = new Rect2(
|
||||
new Vector2(currentChunk.Transform.origin.x, currentChunk.Transform.origin.z)
|
||||
+ currentChunk.PlaneRect.Position,
|
||||
currentChunk.PlaneRect.Size);
|
||||
GD.Print("Center Chunk Rect: " + _centerChunkRect.Position + " size: " + _centerChunkRect.Size);
|
||||
|
||||
// load or create adjacent chunks
|
||||
_activeChunkIndices = new List<Vector2>();
|
||||
_activeChunkIndices.Add(CenterChunkIndex + new Vector2(-1, -1));
|
||||
|
@ -333,7 +324,6 @@ public class World : Spatial {
|
|||
foreach (Vector2 activeChunkIndex in _activeChunkIndices) {
|
||||
WorldChunk chunk = GetOrCreateWorldChunk(activeChunkIndex,
|
||||
new Color(GD.Randf(), GD.Randf(), GD.Randf()));
|
||||
_cachedWorldChunks[activeChunkIndex] = chunk;
|
||||
}
|
||||
|
||||
Debug.Assert(_activeChunkIndices.Count == NumChunkRows * NumChunkColumns);
|
||||
|
@ -344,6 +334,18 @@ public class World : Spatial {
|
|||
State = GenerationState.Heightmap;
|
||||
}
|
||||
}
|
||||
|
||||
WorldChunk currentChunk = GetOrCreateWorldChunk(CenterChunkIndex,
|
||||
new Color(GD.Randf(), GD.Randf(), GD.Randf()));
|
||||
|
||||
_centerChunkRect = new Rect2(
|
||||
new Vector2(currentChunk.Transform.origin.x, currentChunk.Transform.origin.z)
|
||||
+ currentChunk.PlaneRect.Position,
|
||||
currentChunk.PlaneRect.Size);
|
||||
|
||||
UpdateChunkBounds();
|
||||
|
||||
UpdateNavigationBounds();
|
||||
}
|
||||
|
||||
private void ActivateChunk(WorldChunk chunk, Vector2 chunkIndex) {
|
||||
|
@ -398,10 +400,6 @@ public class World : Spatial {
|
|||
|
||||
if (!_centerChunkRect.HasPoint(centerPlaneCoord)) {
|
||||
UpdateCenterChunkFromPlaneCoord(centerPlaneCoord);
|
||||
|
||||
UpdateChunkBounds();
|
||||
|
||||
UpdateNavigationBounds();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue