From 6ad4012ebcbdb46a185a12b5a7525c43c440e386 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Mon, 3 Feb 2020 20:09:34 -0500 Subject: [PATCH] Implemented corner tiles for the start/end of each obstacle course --- Assets/Scenes/Floor Level.unity | 17 +++++++++++++ Assets/Scripts/FloorLevel.cs | 45 ++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Assets/Scenes/Floor Level.unity b/Assets/Scenes/Floor Level.unity index c2521f1..e2f2d1c 100644 --- a/Assets/Scenes/Floor Level.unity +++ b/Assets/Scenes/Floor Level.unity @@ -2503,6 +2503,23 @@ MonoBehaviour: - {fileID: 2729766386463878366, guid: 258ef028e1596b043b63e318da3964f2, type: 3} boundaries: {fileID: 9181995847428758509, guid: cd8f80a3dcff4954598e8b72fd740734, type: 3} + cornerList: + - {fileID: 3821658720673687754, guid: d0164d7ee6ae94349b5fb425366d9805, type: 3} + - {fileID: 5412598120349462372, guid: a7a9bd40273944b4694f6dfb9f5a76fd, type: 3} + - {fileID: 6892012537429466651, guid: 7e22ae0ac8a6ee74382bf8470a62d9c7, type: 3} + - {fileID: 13043432947673379, guid: 108e9dead958fbe44b3a5fd2728ea752, type: 3} + - {fileID: 5880479941740923922, guid: d8233406c7b546e419c918c028ec65af, type: 3} + - {fileID: 4508217524918111061, guid: 974e0a3ecc779f64cb2866cd68650407, type: 3} + - {fileID: 7301985093577449120, guid: dbf6fd673e9b7944f9f526400284d0af, type: 3} + - {fileID: 8014827120313548368, guid: 20d028e2f45dd134fbaf292705530768, type: 3} + - {fileID: 1236683392463883085, guid: b49833699123fc74886c706b80b7cbfe, type: 3} + - {fileID: 2905477253455755942, guid: cc2991a7dd7e57d4b89e9b7cc0d29440, type: 3} + - {fileID: 2709827901078906258, guid: ff7c3b7d52b8de54e9917c40c82aecc4, type: 3} + - {fileID: 7191534383892929012, guid: 6de824c9a7c7a334284769001bca9c75, type: 3} + - {fileID: 986717874393107686, guid: da5fd426b6efd1842a8e9be671efb9a0, type: 3} + - {fileID: 3013432613321896070, guid: ec98b0672cd5ccc47a100c01a398b97a, type: 3} + - {fileID: 2729766386463878366, guid: 258ef028e1596b043b63e318da3964f2, type: 3} + - {fileID: 3425233021637308467, guid: 9cfafec4161cf3c4f86a3824513846ac, type: 3} --- !u!4 &1677821150 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/FloorLevel.cs b/Assets/Scripts/FloorLevel.cs index b8b4c4f..93e951f 100644 --- a/Assets/Scripts/FloorLevel.cs +++ b/Assets/Scripts/FloorLevel.cs @@ -18,6 +18,7 @@ public class FloorLevel : MonoBehaviour public GameObject[] easyObstacleList; public GameObject[] medObstaclelIst; public GameObject boundaries; + public GameObject[] cornerList; private int selection = 0; @@ -107,7 +108,7 @@ public class FloorLevel : MonoBehaviour for(int i = 0; i < escalation; i++){ for(int j = 0; j < escalation; j++){ - if(Random.Range(0, 20) != 0 || (i == (escalation-1) && j == (escalation-1) && i == j)) + if(Random.Range(0, 10) != 0 || (i == (escalation-1) && j == (escalation-1) && i == j)) { switch (level) { @@ -115,11 +116,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(0, easyObstacleList.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 7 || selection == 8) { - Instantiate(easyObstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); } else { - Instantiate(easyObstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); } } else { @@ -130,11 +132,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(0, medObstaclelIst.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 15 || selection == 16) { - Instantiate(medObstaclelIst[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); } else { - Instantiate(medObstaclelIst[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(medObstaclelIst[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0)); @@ -144,11 +147,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(2, obstacleList.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 23 || selection == 24) { - Instantiate(obstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); } else { - Instantiate(obstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(obstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0)); @@ -158,11 +162,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(2, obstacleList.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 23 || selection == 24) { - Instantiate(obstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.identity); } else { - Instantiate(obstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(obstacleList[selection], new Vector3(100*i+50, Random.Range(-5, 0), 100*j+50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0)); @@ -171,7 +176,7 @@ public class FloorLevel : MonoBehaviour } } - if(Random.Range(0, 20) != 0 || (i == (escalation-1) && j == (escalation-1) && i == j)) + if(Random.Range(0, 10) != 0 || (i == (escalation-1) && j == (escalation-1) && i == j)) { switch (level) @@ -180,11 +185,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(0, easyObstacleList.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 7 || selection == 8) { - Instantiate(easyObstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); } else { - Instantiate(easyObstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(easyObstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0)); @@ -194,11 +200,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(0, medObstaclelIst.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 15 || selection == 16) { - Instantiate(medObstaclelIst[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); } else { - Instantiate(medObstaclelIst[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(medObstaclelIst[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0)); @@ -208,11 +215,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(2, obstacleList.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 23 || selection == 24) { - Instantiate(obstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); } else { - Instantiate(obstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(obstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0)); @@ -222,11 +230,12 @@ public class FloorLevel : MonoBehaviour selection = Random.Range(2, obstacleList.Length); if(i == (escalation-1) && j == (escalation-1) && i == j) { + selection = Random.Range(0, cornerList.Length); if(selection == 0 || selection == 23 || selection == 24) { - Instantiate(obstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.identity); } else { - Instantiate(obstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); + Instantiate(cornerList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, 45, 0)); } } else { Instantiate(obstacleList[selection], new Vector3(-100*i-50, Random.Range(-5, 0), -100*j-50), Quaternion.Euler(0, (45*Random.Range(0,8)), 0));