From 17747d23ccb12f1414ebfbb118316d8dccf7f68d Mon Sep 17 00:00:00 2001 From: GamerClassN7 Date: Sat, 29 Jan 2022 21:27:01 +0100 Subject: [PATCH] IsFalling Implementation Leave level intact --- Assets/Scripts/ProceduralGeneration.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/ProceduralGeneration.cs b/Assets/Scripts/ProceduralGeneration.cs index 31f737d..841d608 100644 --- a/Assets/Scripts/ProceduralGeneration.cs +++ b/Assets/Scripts/ProceduralGeneration.cs @@ -74,6 +74,7 @@ public class ProceduralGeneration : MonoBehaviour void Update() { Vector3 playerPosition = this.player.transform.position; + PlayerController playerControlsSript = this.player.GetComponent(); for (var i = 0; i < this.spawnedLevelBlocks.Count; i++) { @@ -97,12 +98,15 @@ public class ProceduralGeneration : MonoBehaviour int blockToSpawn = Random.Range(0, (levelBlocks.Count + 1)); - if (blockToSpawn > 31 && (blockToSpawn < levelBlocks.Count) && levelBlocks[blockToSpawn].name == lastBlockPrefab.name) + if (playerControlsSript.isFalling == false) ; { - Debug.Log("Same Block"); - if (blockToSpawn > levelBlocks.Count || blockToSpawn < 0) + if (blockToSpawn > 31 && (blockToSpawn < levelBlocks.Count) && levelBlocks[blockToSpawn].name == lastBlockPrefab.name) { - blockToSpawn = Random.Range(0, levelBlocks.Count); + Debug.Log("Same Block"); + if (blockToSpawn > levelBlocks.Count || blockToSpawn < 0) + { + blockToSpawn = Random.Range(0, levelBlocks.Count); + } } }