Added boundary walls to infinity race

This commit is contained in:
Gregory Campbell
2020-02-01 17:56:51 -05:00
parent 87e530634a
commit a1b3add28d
3 changed files with 42 additions and 7 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ GameObject:
- component: {fileID: 3722481429377445630} - component: {fileID: 3722481429377445630}
m_Layer: 0 m_Layer: 0
m_Name: Boundaries Wall m_Name: Boundaries Wall
m_TagString: Wall m_TagString: Environment
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
+2
View File
@@ -2316,6 +2316,8 @@ MonoBehaviour:
- {fileID: 1821288648812870990, guid: 5d8f4307c13dc6142bece8e0b1f30bae, type: 3} - {fileID: 1821288648812870990, guid: 5d8f4307c13dc6142bece8e0b1f30bae, type: 3}
- {fileID: 7301985093577449120, guid: dbf6fd673e9b7944f9f526400284d0af, type: 3} - {fileID: 7301985093577449120, guid: dbf6fd673e9b7944f9f526400284d0af, type: 3}
- {fileID: 4508217524918111061, guid: 974e0a3ecc779f64cb2866cd68650407, type: 3} - {fileID: 4508217524918111061, guid: 974e0a3ecc779f64cb2866cd68650407, type: 3}
boundaries: {fileID: 9181995847428758509, guid: cd8f80a3dcff4954598e8b72fd740734,
type: 3}
--- !u!1 &1834093088 --- !u!1 &1834093088
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+39 -6
View File
@@ -17,6 +17,7 @@ public class InfinityRunner : MonoBehaviour
public GameObject[] obstacleList; public GameObject[] obstacleList;
public GameObject[] easyObstacleList; public GameObject[] easyObstacleList;
public GameObject[] medObstaclelIst; public GameObject[] medObstaclelIst;
public GameObject boundaries;
private int selection; private int selection;
private float countdownTime = 5.0f; private float countdownTime = 5.0f;
@@ -67,6 +68,8 @@ public class InfinityRunner : MonoBehaviour
} }
GameObject spawn; GameObject spawn;
GameObject wallOne;
GameObject wallTwo;
if(level == 1) if(level == 1)
{ {
@@ -81,8 +84,12 @@ public class InfinityRunner : MonoBehaviour
} else { } else {
selection = Random.Range(0, easyObstacleList.Length); 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; 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 { } else {
if(escalation > 2 && escalation < 5) 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; 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)); 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; lastSpawn = spawn.transform;
spawnTime = Time.time; 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() void levelBuild()
{ {
GameObject start = Instantiate(obstacleList[0], new Vector3(0, 0, 0), Quaternion.identity) as GameObject; GameObject walls;
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 start = Instantiate(obstacleList[0], new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
start.transform.localScale = new Vector3(25, 1, 25); 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; lastSpawn = startTwo.transform;