diff --git a/MrBigsock/Assets/Code/FollowPlayer.cs b/MrBigsock/Assets/Code/FollowPlayer.cs index bd91e28204bc6f4bea5691a6dc160ed46a4bca5f..79d41e40eaeaf36dbdd791370f39a543e069ea89 100644 --- a/MrBigsock/Assets/Code/FollowPlayer.cs +++ b/MrBigsock/Assets/Code/FollowPlayer.cs @@ -41,27 +41,36 @@ namespace Bigsock c.SetActive(false); } stairs_down = stair.GetComponent<Stairs>().stairs_touch; + stair.SetActive(false); } void LateUpdate() { boss = GameObject.FindGameObjectsWithTag("Boss"); enemies = GameObject.FindGameObjectsWithTag((roomNr).ToString()); - stairs_down = stair.GetComponent<Stairs>().stairs_touch; + if (boss.Length == 0 && levels <= 1) + { + stair.SetActive(true); + stairs_down = stair.GetComponent<Stairs>().stairs_touch; + } + - if (boss.Length == 0 && levels <= 1 && stairs_down) + if (stairs_down) { roomNr = 0; foreach(GameObject c in chests) { Destroy(c); } + DestroyImmediate(stair); chests.Clear(); TilemapGenerator.resetMaps(); TilemapGenerator.SetRoomIDZero(); player.transform.position = new Vector3(9,5,0); neighborMapGenerator.RunProceduralGeneration(); Chest = GameObject.FindGameObjectsWithTag("Chest"); + stair = GameObject.Find("Stairs(Clone)"); + stairs_down = stair.GetComponent<Stairs>().stairs_touch; foreach (GameObject c in Chest) { if(c != null) @@ -70,6 +79,7 @@ namespace Bigsock chests.Add(c); } } + stair.SetActive(false); levels++; }