diff --git a/Assets/Prefabs/Walls/Boundaries Wall.prefab b/Assets/Prefabs/Walls/Boundaries Wall.prefab index e2ee9f8..b312feb 100644 --- a/Assets/Prefabs/Walls/Boundaries Wall.prefab +++ b/Assets/Prefabs/Walls/Boundaries Wall.prefab @@ -107,7 +107,7 @@ GameObject: - component: {fileID: 3722481429377445630} m_Layer: 0 m_Name: Boundaries Wall - m_TagString: Wall + m_TagString: Environment m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Scenes/Infinity Runner.unity b/Assets/Scenes/Infinity Runner.unity index 378fbd1..8636790 100644 --- a/Assets/Scenes/Infinity Runner.unity +++ b/Assets/Scenes/Infinity Runner.unity @@ -2316,6 +2316,8 @@ MonoBehaviour: - {fileID: 1821288648812870990, guid: 5d8f4307c13dc6142bece8e0b1f30bae, type: 3} - {fileID: 7301985093577449120, guid: dbf6fd673e9b7944f9f526400284d0af, type: 3} - {fileID: 4508217524918111061, guid: 974e0a3ecc779f64cb2866cd68650407, type: 3} + boundaries: {fileID: 9181995847428758509, guid: cd8f80a3dcff4954598e8b72fd740734, + type: 3} --- !u!1 &1834093088 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/InfinityRunner.cs b/Assets/Scripts/InfinityRunner.cs index d0d7eb0..16239db 100644 --- a/Assets/Scripts/InfinityRunner.cs +++ b/Assets/Scripts/InfinityRunner.cs @@ -17,6 +17,7 @@ public class InfinityRunner : MonoBehaviour public GameObject[] obstacleList; public GameObject[] easyObstacleList; public GameObject[] medObstaclelIst; + public GameObject boundaries; private int selection; private float countdownTime = 5.0f; @@ -67,6 +68,8 @@ public class InfinityRunner : MonoBehaviour } GameObject spawn; + GameObject wallOne; + GameObject wallTwo; if(level == 1) { @@ -81,8 +84,12 @@ public class InfinityRunner : MonoBehaviour } else { selection = Random.Range(0, easyObstacleList.Length); spawn = Instantiate(easyObstacleList[selection], new Vector3(0, 0, lastSpawn.transform.position.z+(25*escalation)-12.5f), Quaternion.identity) as GameObject; + } + wallOne = Instantiate(boundaries, new Vector3(((25f*(escalation)))/2, 0, lastSpawn.transform.position.z+(25*escalation)-12.5f), Quaternion.identity) as GameObject; + wallTwo = Instantiate(boundaries, new Vector3(((25f*(escalation)))/-2, 0, lastSpawn.transform.position.z+(25*escalation)-12.5f), Quaternion.identity) as GameObject; + } else { if(escalation > 2 && escalation < 5) @@ -97,15 +104,23 @@ public class InfinityRunner : MonoBehaviour spawn = Instantiate(easyObstacleList[selection], new Vector3(0, 0, lastSpawn.transform.position.z+(25*escalation)), Quaternion.identity) as GameObject; } + wallOne = Instantiate(boundaries, new Vector3(((25f*(escalation)))/2, 0, lastSpawn.transform.position.z+(25*escalation)), Quaternion.identity) as GameObject; + wallTwo = Instantiate(boundaries, new Vector3(((25f*(escalation)))/-2, 0, lastSpawn.transform.position.z+(25*escalation)), Quaternion.identity) as GameObject; + } spawn.transform.localScale = new Vector3(spawn.transform.localScale.x*(0.25f*(escalation)), 1, spawn.transform.localScale.z*(0.25f*escalation)); + wallOne.transform.localScale = new Vector3(wallOne.transform.localScale.x*(0.25f*(escalation)), 1, wallOne.transform.localScale.z*(0.25f*escalation)); + wallTwo.transform.localScale = new Vector3(wallTwo.transform.localScale.x*(0.25f*(escalation)), 1, wallTwo.transform.localScale.z*(0.25f*escalation)); lastSpawn = spawn.transform; spawnTime = Time.time; - Destroy(GameObject.FindWithTag("Environment")); + GameObject[] oldObjects = GameObject.FindGameObjectsWithTag("Environment"); + for(int i = 0; i < 3; i++) { + GameObject.Destroy(oldObjects[i]); + } } @@ -142,13 +157,31 @@ public class InfinityRunner : MonoBehaviour void levelBuild() { - GameObject start = Instantiate(obstacleList[0], new Vector3(0, 0, 0), Quaternion.identity) as GameObject; - GameObject startOne = Instantiate(obstacleList[0], new Vector3(0, 0, 25), Quaternion.identity) as GameObject; - GameObject startTwo = Instantiate(obstacleList[0], new Vector3(0, 0, 50), Quaternion.identity) as GameObject; + GameObject walls; + GameObject start = Instantiate(obstacleList[0], new Vector3(0, 0, 0), Quaternion.identity) as GameObject; start.transform.localScale = new Vector3(25, 1, 25); - startOne.transform.localScale = new Vector3(25, 1, 25); - startTwo.transform.localScale = new Vector3(25, 1, 25); + + walls = Instantiate(boundaries, new Vector3(12.5f, 0, 0), Quaternion.identity) as GameObject; + walls.transform.localScale = new Vector3(0.25f, 1, 0.25f); + walls = Instantiate(boundaries, new Vector3(-12.5f, 0, 0), Quaternion.identity) as GameObject; + walls.transform.localScale = new Vector3(0.25f, 1, 0.25f); + + GameObject startOne = Instantiate(obstacleList[0], new Vector3(0, 0, 25), Quaternion.identity) as GameObject; + startOne.transform.localScale = new Vector3(25, 1, 25); + + walls = Instantiate(boundaries, new Vector3(12.5f, 0, 25), Quaternion.identity) as GameObject; + walls.transform.localScale = new Vector3(0.25f, 1, 0.25f); + walls = Instantiate(boundaries, new Vector3(-12.5f, 0, 25), Quaternion.identity) as GameObject; + walls.transform.localScale = new Vector3(0.25f, 1, 0.25f); + + GameObject startTwo = Instantiate(obstacleList[0], new Vector3(0, 0, 50), Quaternion.identity) as GameObject; + startTwo.transform.localScale = new Vector3(25, 1, 25); + + walls = Instantiate(boundaries, new Vector3(12.5f, 0, 50), Quaternion.identity) as GameObject; + walls.transform.localScale = new Vector3(0.25f, 1, 0.25f); + walls = Instantiate(boundaries, new Vector3(-12.5f, 0, 50), Quaternion.identity) as GameObject; + walls.transform.localScale = new Vector3(0.25f, 1, 0.25f); lastSpawn = startTwo.transform;