diff --git a/MrBigsock/Assets/Code/FollowPlayer.cs b/MrBigsock/Assets/Code/FollowPlayer.cs index 9e93324b412d4274860b5a5ed163e5b0abe649a4..bd91e28204bc6f4bea5691a6dc160ed46a4bca5f 100644 --- a/MrBigsock/Assets/Code/FollowPlayer.cs +++ b/MrBigsock/Assets/Code/FollowPlayer.cs @@ -1,10 +1,7 @@ -using System.Collections; using System.Collections.Generic; -using System.Linq; +using BigSock.Interact; using Cinemachine; using UnityEngine; -using UnityEngine.Tilemaps; -using static System.Net.WebRequestMethods; namespace Bigsock @@ -27,27 +24,32 @@ namespace Bigsock GameObject[] enemies; GameObject[] Chest; List<GameObject> chests; + GameObject stair; private int roomNr = 0; + bool stairs_down; void Start() { chests = new List<GameObject>(); neighborMapGenerator.RunProceduralGeneration(); player = GameObject.Find("BigSock"); + stair = GameObject.Find("Stairs(Clone)"); Chest = GameObject.FindGameObjectsWithTag("Chest"); foreach(GameObject c in Chest) { chests.Add(c); c.SetActive(false); } + stairs_down = stair.GetComponent<Stairs>().stairs_touch; } void LateUpdate() { boss = GameObject.FindGameObjectsWithTag("Boss"); enemies = GameObject.FindGameObjectsWithTag((roomNr).ToString()); + stairs_down = stair.GetComponent<Stairs>().stairs_touch; - if (boss.Length == 0 && levels <= 1 && Input.GetKey(KeyCode.Return)) + if (boss.Length == 0 && levels <= 1 && stairs_down) { roomNr = 0; foreach(GameObject c in chests) @@ -57,9 +59,9 @@ namespace Bigsock chests.Clear(); TilemapGenerator.resetMaps(); TilemapGenerator.SetRoomIDZero(); + player.transform.position = new Vector3(9,5,0); neighborMapGenerator.RunProceduralGeneration(); Chest = GameObject.FindGameObjectsWithTag("Chest"); - Debug.Log("Size: " + Chest.Length); foreach (GameObject c in Chest) { if(c != null) @@ -68,14 +70,12 @@ namespace Bigsock chests.Add(c); } } - player.transform.position = new Vector3(9, 5, 0); levels++; } int i = 0; if(i == 0) { cameraMap.InvalidateCache(); - i++; } if (enemies.Length == 0)