This commit is contained in:
GamerClassN7 2022-01-30 11:43:14 +01:00
parent c8959959f0
commit 2bb3e99c35
2 changed files with 41 additions and 4 deletions

View File

@ -195,6 +195,11 @@ MonoBehaviour:
- {fileID: 1316835597118596560, guid: edd9e993fa2520f4095e33c7552ecd54, type: 3} - {fileID: 1316835597118596560, guid: edd9e993fa2520f4095e33c7552ecd54, type: 3}
- {fileID: 1316835597118596560, guid: b140cd85c7d7ba64cbc9ab71d92e349e, type: 3} - {fileID: 1316835597118596560, guid: b140cd85c7d7ba64cbc9ab71d92e349e, type: 3}
spawnedLevelBlocks: [] spawnedLevelBlocks: []
backgroundBlocks:
- {fileID: 5287741263160770601, guid: 7a596fa177a8fd34face58d8f58e0e41, type: 3}
- {fileID: 2394897577413455488, guid: 1348a4eeda762ae4db83cd873efb4c44, type: 3}
backgroundLevelBlocks: []
bgParrent: {fileID: 1253020012}
player: {fileID: 250075900} player: {fileID: 250075900}
lastBlock: {fileID: 126480931} lastBlock: {fileID: 126480931}
--- !u!1 &705507993 --- !u!1 &705507993
@ -291,6 +296,37 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1253020012
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1253020013}
m_Layer: 0
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1253020013
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1253020012}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.7466898, y: 11.656877, z: 19.668505}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1287430439 --- !u!1001 &1287430439
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -410,7 +446,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2628890434173161083, guid: aa81b1bce294ebf42a0a5fff43100935, type: 3} - target: {fileID: 2628890434173161083, guid: aa81b1bce294ebf42a0a5fff43100935, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2628890434173161083, guid: aa81b1bce294ebf42a0a5fff43100935, type: 3} - target: {fileID: 2628890434173161083, guid: aa81b1bce294ebf42a0a5fff43100935, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x

View File

@ -9,27 +9,28 @@ public class ProceduralGeneration : MonoBehaviour
private int maximumNumberOfPlatformsAtScene = 100; private int maximumNumberOfPlatformsAtScene = 100;
public List<GameObject> spawnedLevelBlocks = new List<GameObject>(); public List<GameObject> spawnedLevelBlocks = new List<GameObject>();
private float maximumDistanceOfPlatformFromPlayer = 20.0f; private float maximumDistanceOfPlatformFromPlayer = 20.0f;
private GameObject levelParrent = null;
[Header("Background")] [Header("Background")]
public List<GameObject> backgroundBlocks = new List<GameObject>(); public List<GameObject> backgroundBlocks = new List<GameObject>();
public List<GameObject> backgroundLevelBlocks = new List<GameObject>(); public List<GameObject> backgroundLevelBlocks = new List<GameObject>();
private float maximumDistanceOfPlatformFromPlayerBg = 600.0f; private float maximumDistanceOfPlatformFromPlayerBg = 600.0f;
public GameObject bgParrent = null;
public GameObject player = null; public GameObject player = null;
public GameObject lastBlock; public GameObject lastBlock;
private GameObject lastBlockPrefab; private GameObject lastBlockPrefab;
private GameObject levelParrent = null;
List<GameObject> spawnBackgroundObjects(Vector3 playerPosition, List<GameObject> backgroundBlocks, GameObject parentLevelObject) List<GameObject> spawnBackgroundObjects(Vector3 playerPosition, List<GameObject> backgroundBlocks, GameObject parentLevelObject)
{ {
List<GameObject> bgBlocksSpawnTemp = new List<GameObject>(); List<GameObject> bgBlocksSpawnTemp = new List<GameObject>();
for (var i = 0; i < 200; i++) for (var i = 0; i < 200; i++)
{ {
int bgElement = Random.Range(0, backgroundBlocks.Count); int bgElement = Random.Range(0, backgroundBlocks.Count - 1);
GameObject newBgObject = Instantiate(backgroundBlocks[bgElement], (Random.insideUnitSphere * Random.Range(300, maximumDistanceOfPlatformFromPlayerBg) + playerPosition + new Vector3(0, 0, 50)), (Quaternion.identity)); GameObject newBgObject = Instantiate(backgroundBlocks[bgElement], (Random.insideUnitSphere * Random.Range(300, maximumDistanceOfPlatformFromPlayerBg) + playerPosition + new Vector3(0, 0, 50)), (Quaternion.identity));
newBgObject.transform.Rotate(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360))); newBgObject.transform.Rotate(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)));
newBgObject.transform.parent = parentLevelObject.transform; newBgObject.transform.parent = bgParrent.transform;
bgBlocksSpawnTemp.Add(newBgObject); bgBlocksSpawnTemp.Add(newBgObject);
} }