diff --git a/MrBigsock/Assets/Code/FollowPlayer.cs b/MrBigsock/Assets/Code/FollowPlayer.cs index 89d4fe1efdecc0d0d6a6b9b3a6b9697ef787f59a..0a4ad56964aed5f11084cd780aea7b7d36f0b7a0 100644 --- a/MrBigsock/Assets/Code/FollowPlayer.cs +++ b/MrBigsock/Assets/Code/FollowPlayer.cs @@ -12,8 +12,9 @@ namespace Bigsock private NeighbourMapGenerator neighborMapGenerator; [SerializeField] private CinemachineConfiner2D cameraMap; + [SerializeField] GameObject VictoryScreen; - private int levels = 1; + private int levels = 0; Vector3 offset = new Vector3(0, 0, -10); @@ -25,8 +26,10 @@ namespace Bigsock GameObject[] Chest; List<GameObject> chests; GameObject stair; + int finalLevel = 2; private int roomNr = 0; bool stairs_down; + int h = 0; void Start() { @@ -42,23 +45,43 @@ namespace Bigsock } stairs_down = stair.GetComponent<Stairs>().stairs_touch; stair.SetActive(false); + } void LateUpdate() { boss = GameObject.FindGameObjectsWithTag("Boss"); enemies = GameObject.FindGameObjectsWithTag((roomNr).ToString()); - if (boss.Length == 0 && levels <= 1) + + if (boss.Length == 0 && levels < 2) { + if (!stair.activeInHierarchy) + { + Debug.Log("hei"); + levels++; + } stair.SetActive(true); stairs_down = stair.GetComponent<Stairs>().stairs_touch; + + } + if (levels == finalLevel && h == 0) + { + Time.timeScale = 0; + GameObject canvas = GameObject.Find("Canvas"); + if(canvas != null) + { + Instantiate(VictoryScreen, canvas.transform); + h++; + } } + + if (stairs_down) { roomNr = 0; - foreach(GameObject c in chests) + foreach (GameObject c in chests) { DestroyImmediate(c); } @@ -80,7 +103,7 @@ namespace Bigsock } } stair.SetActive(false); - levels++; + } int i = 0;