This commit is contained in:
GamerClassN7 2022-01-29 19:13:01 +01:00
parent 80c944f6b0
commit b915eb3120
3 changed files with 28 additions and 21 deletions

View File

@ -1391,7 +1391,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3244356566819001084}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 3.67}
m_LocalPosition: {x: 0, y: 4.32, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -1414,7 +1414,7 @@ MeshRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3244356566819001084}
m_Enabled: 0
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
@ -1477,17 +1477,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b108dca155b156640a1beb1eeaa1995d, type: 3}
m_Name:
m_EditorClassIdentifier:
walkSpeed: 7.5
runningSpeed: 7.5
speed: 7.5
maxSpeed: 15
minSpeed: 5
currentSpeed: 0
isRunning: 0
jumpSpeed: 3
jump: 0
lookSpeed: 7.5
lookXLimit: 8.75
playerCamera: {fileID: 3244356567913423211}
runningParticles: {fileID: 1608137079}
rotationX: 0
runningParticles: {fileID: 1608137079}
mainObject: {fileID: 3244356567786994345}
jump: 0
isRunning: 0
--- !u!65 &1172583624
BoxCollider:
m_ObjectHideFlags: 0

View File

@ -148,7 +148,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 327689120}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 89.75318, y: 61.538616, z: 75.9285}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -172,7 +172,9 @@ MonoBehaviour:
- {fileID: 8768991388683709947, guid: 32d2ba4971e4c7e4ab98a1f9c37dcffc, type: 3}
- {fileID: 8768991388683709947, guid: 99c4e582c7358f346ab00dae4ae956f9, type: 3}
- {fileID: 6650340373999088090, guid: 76b3e3235b07ca04f91c9b020603e1dd, type: 3}
spawnedLevelBlocks: []
player: {fileID: 1621231496}
lastBlock: {fileID: 708734972}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
@ -357,7 +359,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708734972}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -92.17318, y: -60.936543, z: -70.85989}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 6.7204876, y: 1.5078, z: 16.238924}
m_ConstrainProportionsScale: 0
m_Children: []
@ -431,7 +433,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3244356566819001085, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_LocalPosition.x
value: -2.9
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3244356566819001085, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3244356567786994344, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_Name
@ -447,11 +453,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_LocalPosition.y
value: 2.84
value: 3.18
objectReference: {fileID: 0}
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: -0.9
objectReference: {fileID: 0}
- target: {fileID: 3244356567786994345, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_LocalRotation.w

View File

@ -18,15 +18,14 @@ public class ProceduralGeneration : MonoBehaviour
{
lastBlockPrefab = this.gameObject.transform.GetChild(0).gameObject;
lastBlock = this.gameObject.transform.GetChild(0).gameObject;
lastBlockSpawnPoint = this.gameObject.transform.GetChild(0).gameObject.transform.position;
this.spawnedLevelBlocks.Add(lastBlock);
}
List<GameObject> drawLoop(GameObject lastObject, GameObject objToSpawn)
{
// configuration:
float heightOffset = 10f;
float horizontalDistancePerPlatform = 10f;
//
float horizontalDistancePerPlatform = 0.5f;
List<GameObject> levelBlocksSpawnTemp = new List<GameObject>();
Debug.Log("Building LOOP");
@ -36,6 +35,8 @@ public class ProceduralGeneration : MonoBehaviour
float angle = 360f / (float)pieceCount;
Vector3 centerPoint = new Vector3(lastObject.transform.position.x, (lastObject.transform.position.y + radius), lastObject.transform.position.z);
float heightOffset = radius;
for (int i = 1; i < pieceCount + 2; i++)
{
Quaternion rotation = (Quaternion.AngleAxis((i - 1) * angle, Vector3.back));
@ -51,19 +52,21 @@ public class ProceduralGeneration : MonoBehaviour
// Update is called once per frame
void Update()
{
int maxNumberOfBlock = 20;
Vector3 playerPosition = this.player.transform.position;
float distance = Vector3.Distance(this.spawnedLevelBlocks[0].transform.position, playerPosition);
Debug.Log("Index" + 0);
if (distance > 10.0f && this.spawnedLevelBlocks.Count > 10)
if (distance > 20.0f && this.spawnedLevelBlocks.Count > maxNumberOfBlock)
{
Destroy(this.spawnedLevelBlocks[0]);
this.spawnedLevelBlocks.Remove(this.spawnedLevelBlocks[0]);
spavnetobjectIndex++;
}
if (this.spawnedLevelBlocks.Count <= 10)
if (this.spawnedLevelBlocks.Count <= maxNumberOfBlock)
{
MeshFilter meshfilter = lastBlock.GetComponent<MeshFilter>();
Bounds bounds = meshfilter.mesh.bounds;
@ -73,8 +76,6 @@ public class ProceduralGeneration : MonoBehaviour
int blockToSpawn = Random.Range(0, levelBlocks.Count - 1);
Debug.Log(blockToSpawn);
GameObject instantiatedGameObject;
GameObject blockObjToSpawn;
@ -114,7 +115,6 @@ public class ProceduralGeneration : MonoBehaviour
{
this.spawnedLevelBlocks.Add(spavnedBlock);
blockIndex++;
}
instantiatedGameObject = this.spawnedLevelBlocks[this.spawnedLevelBlocks.Count - 1];
blockObjToSpawn = levelBlocks[0];
@ -122,7 +122,6 @@ public class ProceduralGeneration : MonoBehaviour
Debug.Log("Spawn" + blockToSpawn);
lastBlock = instantiatedGameObject;
lastBlockSpawnPoint = instantiatedGameObject.transform.position;
lastBlockPrefab = blockObjToSpawn;