This commit is contained in:
GamerClassN7 2022-01-30 14:17:35 +01:00
parent c8ed54aab6
commit 85dda8c96e
1 changed files with 6 additions and 0 deletions

View File

@ -58,6 +58,7 @@ public class ProceduralGeneration : MonoBehaviour
}
GameObject drawPlatform(GameObject lastObject, GameObject objToSpawn, GameObject parentLevelObject)
{
Bounds bounds = this.getPrefabBounds(lastObject);
Bounds b = this.getPrefabBounds(objToSpawn);
Vector3 nextBlockLocation = new Vector3(lastObject.transform.position.x, lastObject.transform.position.y, lastObject.transform.position.z + bounds.extents.z + b.extents.z);
@ -177,6 +178,11 @@ public class ProceduralGeneration : MonoBehaviour
if (blockToSpawn > -1 && (blockToSpawn < levelBlocks.Count))
{
if (this.spawnedLevelBlocks.Count == 3)
{
blockToSpawn = 10;
}
blockObjToSpawn = levelBlocks[blockToSpawn];
instantiatedGameObject = this.drawPlatform(this.lastBlock, this.levelBlocks[blockToSpawn], this.levelParrent);
this.spawnedLevelBlocks.Add(instantiatedGameObject);