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

fix looped generation. Fix: reset stair_down value to false and destroying existing stairs

parent d3c80528
No related branches found
No related tags found
1 merge request!79Ruud1
......@@ -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++;
}
......
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