feat: level progression (#46)

This commit is contained in:
2025-03-17 18:28:27 +01:00
committed by GitHub
parent a9bd2a0048
commit 872772d3f0
18 changed files with 1717 additions and 35 deletions

View File

@ -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 + "%";
}
}