IsFalling Implementation Leave level intact
This commit is contained in:
parent
4d1855627c
commit
17747d23cc
@ -74,6 +74,7 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
Vector3 playerPosition = this.player.transform.position;
|
Vector3 playerPosition = this.player.transform.position;
|
||||||
|
PlayerController playerControlsSript = this.player.GetComponent<PlayerController>();
|
||||||
|
|
||||||
for (var i = 0; i < this.spawnedLevelBlocks.Count; i++)
|
for (var i = 0; i < this.spawnedLevelBlocks.Count; i++)
|
||||||
{
|
{
|
||||||
@ -97,6 +98,8 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
|
|
||||||
int blockToSpawn = Random.Range(0, (levelBlocks.Count + 1));
|
int blockToSpawn = Random.Range(0, (levelBlocks.Count + 1));
|
||||||
|
|
||||||
|
if (playerControlsSript.isFalling == false) ;
|
||||||
|
{
|
||||||
if (blockToSpawn > 31 && (blockToSpawn < levelBlocks.Count) && levelBlocks[blockToSpawn].name == lastBlockPrefab.name)
|
if (blockToSpawn > 31 && (blockToSpawn < levelBlocks.Count) && levelBlocks[blockToSpawn].name == lastBlockPrefab.name)
|
||||||
{
|
{
|
||||||
Debug.Log("Same Block");
|
Debug.Log("Same Block");
|
||||||
@ -105,6 +108,7 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
blockToSpawn = Random.Range(0, levelBlocks.Count);
|
blockToSpawn = Random.Range(0, levelBlocks.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (blockToSpawn > -1 && (blockToSpawn < levelBlocks.Count))
|
if (blockToSpawn > -1 && (blockToSpawn < levelBlocks.Count))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user