Implement final scene
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Utils;
|
||||
|
||||
@@ -72,16 +73,19 @@ public class MainMenuController : MonoBehaviour
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
GameObject levelButton;
|
||||
|
||||
for (int i = 0; i < GlobalStateManager.Instance.levels.Count; i++)
|
||||
{
|
||||
int levelIndex = i;
|
||||
|
||||
GameObject levelButton = Instantiate(LevelItemPrefab, parent);
|
||||
levelButton = Instantiate(LevelItemPrefab, parent);
|
||||
|
||||
if (i <= GlobalStateManager.Instance.HighestLevel)
|
||||
{
|
||||
levelButton.GetComponentInChildren<Button>().onClick.AddListener(() => {
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
GlobalStateManager.Instance.finalScene = false;
|
||||
GlobalStateManager.Instance.LoadSpecificLevel(levelIndex);
|
||||
});
|
||||
}
|
||||
@@ -91,5 +95,20 @@ public class MainMenuController : MonoBehaviour
|
||||
}
|
||||
levelButton.GetComponentInChildren<TextMeshProUGUI>().text = (i + 1).ToString();
|
||||
}
|
||||
|
||||
levelButton = Instantiate(LevelItemPrefab, parent);
|
||||
if (GlobalStateManager.Instance.HighestLevel == GlobalStateManager.Instance.levels.Count)
|
||||
{
|
||||
levelButton.GetComponentInChildren<Button>().onClick.AddListener(() => {
|
||||
AudioManager.Instance.PlaySound("Select");
|
||||
GlobalStateManager.Instance.LoadSpecificLevel(GlobalStateManager.Instance.levels.Count);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
levelButton.GetComponent<Image>().color = Color.red;
|
||||
}
|
||||
levelButton.GetComponentInChildren<TextMeshProUGUI>().text = "FIN";
|
||||
levelButton.GetComponentInChildren<TextMeshProUGUI>().fontSize/=2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user