Skip to content

Commit

Permalink
seed validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Soskar1 committed Jul 27, 2023
1 parent df99f16 commit 577e747
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 97 deletions.
7 changes: 0 additions & 7 deletions Assets/Plugins/Zenject/Source/Zenject.csproj.meta

This file was deleted.

6 changes: 3 additions & 3 deletions Assets/Scenes/World.unity
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 1.195592, z: -7.956186}
m_FollowOffset: {x: 0, y: 2.574393, z: -8.498599}
m_XDamping: 0
m_YDamping: 0
m_ZDamping: 0
Expand Down Expand Up @@ -3562,7 +3562,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 1.195592, z: -7.956186}
m_FollowOffset: {x: 0, y: 2.574393, z: -8.498599}
m_XDamping: 0
m_YDamping: 0
m_ZDamping: 0
Expand Down Expand Up @@ -3779,7 +3779,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 1.195592, z: -7.956186}
m_FollowOffset: {x: 0, y: 2.574393, z: -8.498599}
m_XDamping: 0
m_YDamping: 0
m_ZDamping: 0
Expand Down
11 changes: 10 additions & 1 deletion Assets/_Scripts/Core/World Generation/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ private void Construct(TerrainGenerator terrainGenerator, StructureGenerator str
public async void GenerateChunks()
{
_renderDistance = (int)_renderDistanceSlider.value;
_worldSeed = _seedInputField.text.Length == 0 ? 0 : Int32.Parse(_seedInputField.text);

try
{
_worldSeed = _seedInputField.text.Length == 0 ? 0 : Int32.Parse(_seedInputField.text);
}
catch
{
_worldSeed = 0;
}

_worldData = new WorldData(_chunkLength, _chunkHeight, _worldSeed);

await GenerateChunks(Vector3Int.zero);
Expand Down
Loading

0 comments on commit 577e747

Please sign in to comment.