This commit is contained in:
2023-01-16 08:19:32 +05:30
parent 122f60bdda
commit fe14f582b9
4 changed files with 139 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ using UnityEngine;
public class LevelGenerator : MonoBehaviour
{
public static LevelGenerator instance{get; private set;}
[SerializeField]private GameObject LevelPrefab;
[SerializeField]private GameObject TopPrefab;
private List<GameObject> spawnedLevels = new List<GameObject>();
@@ -13,17 +14,22 @@ public class LevelGenerator : MonoBehaviour
[SerializeField]private float maxHigh;
[SerializeField]private List<float> Levels;
void Awake(){
instance = this;
}
void Start()
{
GenerateAhead(150);
}
public void GenerateAhead(int count = 10){
if(Levels.Count <= 0){
Levels = new List<float>();
}
Levels.Add(1);
}
int startIndex= Levels.Count;
int lastIndex = Levels.Count +count;
for(int i =startIndex; i < lastIndex; i++){