mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-06-10 22:20:40 +02:00
feat: level progression (#46)
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.IO;
|
||||
|
||||
public class LevelLoader : MonoBehaviour
|
||||
{
|
||||
public LevelsLoader levelsLoader;
|
||||
public AudioSource audioSource;
|
||||
public Text progressionText;
|
||||
|
||||
private GameObject GetPrefab(string type)
|
||||
{
|
||||
@ -31,14 +33,7 @@ public class LevelLoader : MonoBehaviour
|
||||
|
||||
instance.transform.localScale = new Vector3(newScaleX, newScaleY, originalScale.z);
|
||||
}
|
||||
|
||||
LevelElement lastElement = current.elements[^1];
|
||||
float lastX = 15;
|
||||
if (lastElement != null)
|
||||
{
|
||||
lastX += lastElement.x;
|
||||
}
|
||||
Instantiate(GetPrefab("WinnerWall"), new Vector3(lastX, 0, 0), Quaternion.Euler(0, 0, 90));
|
||||
Instantiate(GetPrefab("WinnerWall"), new Vector3(current.LastX, 0, 0), Quaternion.Euler(0, 0, 90));
|
||||
}
|
||||
|
||||
public void Start()
|
||||
@ -52,6 +47,7 @@ public class LevelLoader : MonoBehaviour
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
Level current = levelsLoader.levelCurrent;
|
||||
progressionText.text = current.ProgressionPercent + "%";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user