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
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;
......
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