This commit is contained in:
nexovec 2022-01-29 21:29:13 +01:00
commit 9294c2b8f1
2 changed files with 23 additions and 4 deletions

View File

@ -95,6 +95,7 @@ GameObject:
- component: {fileID: 7164401439626984364}
- component: {fileID: 5928557084490550214}
- component: {fileID: 6189155224637060765}
- component: {fileID: -443919199017515566}
m_Layer: 0
m_Name: platform 2 power
m_TagString: Untagged
@ -181,3 +182,17 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 3.3, y: 0.5, z: 5}
m_Center: {x: 0, y: 0.25, z: 0}
--- !u!114 &-443919199017515566
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7678802340880963262}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fdc803964e5f2b042bece1765b69164f, type: 3}
m_Name:
m_EditorClassIdentifier:
type: 0
speed: 5

View File

@ -74,6 +74,7 @@ public class ProceduralGeneration : MonoBehaviour
void Update()
{
Vector3 playerPosition = this.player.transform.position;
PlayerController playerControlsSript = this.player.GetComponent<PlayerController>();
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);
}
}
}