Skip to content
Snippets Groups Projects
Commit 5fb051bf authored by Robin Ruud Kristensen's avatar Robin Ruud Kristensen
Browse files

added check for when all bosses have been defeated

parent 462d1e6a
No related branches found
No related tags found
1 merge request!85Merge
...@@ -12,8 +12,9 @@ namespace Bigsock ...@@ -12,8 +12,9 @@ namespace Bigsock
private NeighbourMapGenerator neighborMapGenerator; private NeighbourMapGenerator neighborMapGenerator;
[SerializeField] [SerializeField]
private CinemachineConfiner2D cameraMap; private CinemachineConfiner2D cameraMap;
[SerializeField] GameObject VictoryScreen;
private int levels = 1; private int levels = 0;
Vector3 offset = new Vector3(0, 0, -10); Vector3 offset = new Vector3(0, 0, -10);
...@@ -25,8 +26,10 @@ namespace Bigsock ...@@ -25,8 +26,10 @@ namespace Bigsock
GameObject[] Chest; GameObject[] Chest;
List<GameObject> chests; List<GameObject> chests;
GameObject stair; GameObject stair;
int finalLevel = 2;
private int roomNr = 0; private int roomNr = 0;
bool stairs_down; bool stairs_down;
int h = 0;
void Start() void Start()
{ {
...@@ -42,23 +45,43 @@ namespace Bigsock ...@@ -42,23 +45,43 @@ namespace Bigsock
} }
stairs_down = stair.GetComponent<Stairs>().stairs_touch; stairs_down = stair.GetComponent<Stairs>().stairs_touch;
stair.SetActive(false); stair.SetActive(false);
} }
void LateUpdate() void LateUpdate()
{ {
boss = GameObject.FindGameObjectsWithTag("Boss"); boss = GameObject.FindGameObjectsWithTag("Boss");
enemies = GameObject.FindGameObjectsWithTag((roomNr).ToString()); 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); stair.SetActive(true);
stairs_down = stair.GetComponent<Stairs>().stairs_touch; 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) if (stairs_down)
{ {
roomNr = 0; roomNr = 0;
foreach(GameObject c in chests) foreach (GameObject c in chests)
{ {
DestroyImmediate(c); DestroyImmediate(c);
} }
...@@ -80,7 +103,7 @@ namespace Bigsock ...@@ -80,7 +103,7 @@ namespace Bigsock
} }
} }
stair.SetActive(false); stair.SetActive(false);
levels++;
} }
int i = 0; int i = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment