From 134500c1eb5f379887d1ed9ba8ae3f37f17a6326 Mon Sep 17 00:00:00 2001 From: Jakub Sztuba Date: Fri, 6 Jan 2023 18:17:42 +0100 Subject: [PATCH 1/2] Dungeon coords searching method and minor fix with player name input --- Assembly-CSharp.csproj | 1 + Assets/Scenes/MainMenu - CharacterName.unity | 4 ++-- .../ProceduralGeneration/TileMapGenerator.cs | 21 ++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 095d5933..17f9e79e 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -208,6 +208,7 @@ + diff --git a/Assets/Scenes/MainMenu - CharacterName.unity b/Assets/Scenes/MainMenu - CharacterName.unity index a28f9020..7fce5bb6 100644 --- a/Assets/Scenes/MainMenu - CharacterName.unity +++ b/Assets/Scenes/MainMenu - CharacterName.unity @@ -535,7 +535,7 @@ MonoBehaviour: nameOfPlayer: saveName: inputText: {fileID: 637316601} - loadedName: {fileID: 0} + loadedName: --- !u!4 &525115091 Transform: m_ObjectHideFlags: 0 @@ -2731,7 +2731,7 @@ MonoBehaviour: m_LineType: 0 m_HideMobileInput: 0 m_CharacterValidation: 0 - m_CharacterLimit: 0 + m_CharacterLimit: 15 m_OnEndEdit: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Scripts/ProceduralGeneration/TileMapGenerator.cs b/Assets/Scripts/ProceduralGeneration/TileMapGenerator.cs index 20c0a835..74cff5af 100644 --- a/Assets/Scripts/ProceduralGeneration/TileMapGenerator.cs +++ b/Assets/Scripts/ProceduralGeneration/TileMapGenerator.cs @@ -15,6 +15,7 @@ public class TileMapGenerator : MonoBehaviour public Tilemap ground, walls; public Tile ground1, wall1, corner_left_up, corner_left_down, corner_right_down, corner_right_up, left, right, up, down; public Graph graph; + public List availablePos; private void Start() { @@ -83,6 +84,7 @@ public class TileMapGenerator : MonoBehaviour { ground.SetTile(new Vector3Int(pos.x,pos.y,0), ground1); startPosOfPlayer = new Vector3Int(pos.x, pos.y, 0); + availablePos.Add(startPosOfPlayer); } else if (id == 2) { @@ -110,11 +112,28 @@ public class TileMapGenerator : MonoBehaviour GameObject Player = GameObject.FindWithTag("Player"); Player.transform.position = startPosOfPlayer; - + + randomCoordsForStanding(); return true; } + + public Vector3 randomCoordsForStanding() + { + Tile test = new Tile(); + while (true) + { + int bound = availablePos.Count; + int randomVal; + randomVal = Random.Range(0, bound); + Debug.Log(availablePos[randomVal]); + return availablePos[randomVal]; + } + + + } + // Update is called once per frame void Update() { From cc6146631ba72d21a6d508ea86a3ae91ab6c447a Mon Sep 17 00:00:00 2001 From: Jakub Sztuba Date: Fri, 6 Jan 2023 21:52:59 +0100 Subject: [PATCH 2/2] Fix for starting new game window on first run --- Assets/NewGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/NewGame.cs b/Assets/NewGame.cs index cafd1b20..851320c2 100644 --- a/Assets/NewGame.cs +++ b/Assets/NewGame.cs @@ -30,7 +30,7 @@ public class NewGame : MonoBehaviour int isQuest = 1; PlayerPrefs.SetInt("lumberjack", isQuest); - + /* int isKilled = 0; PlayerPrefs.SetInt("bat0", isKilled); @@ -43,7 +43,7 @@ public class NewGame : MonoBehaviour float health = 10.0f; PlayerPrefs.SetFloat("maxHealth", 10); PlayerPrefs.SetFloat("health", 10); - + PlayerPrefs.SetInt("HasEverPlayed",1); //PlayerPrefs.SetInt("continued", 0); PlayerPrefs.SetInt("rock", 0); // Is it used anywhere? I have not found it