added main menu
This commit is contained in:
1 parent
4cbc5a3831
commit
4abec81e5f
97 files changed
+69372
-119
No files matched your search
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bedfcc356abf43cbb31d8068a95eeb26
|
||||
timeCreated: 1770369237
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class MainMenuController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button[] buttons;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
for (var i = 0; i < buttons.Length; i++)
|
||||
{
|
||||
var i1 = i;
|
||||
buttons[i].onClick.AddListener(() => LoadLab(i1));
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadLab(int number)
|
||||
{
|
||||
var sceneName = $"Lab{number + 1}";
|
||||
|
||||
if (Application.CanStreamedLevelBeLoaded(sceneName))
|
||||
SceneManager.LoadScene(sceneName);
|
||||
else
|
||||
Debug.LogWarning($"There is no lab number {number + 1}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcba9ee23fdb4d459ac368ecebd75d26
|
||||
timeCreated: 1770369247
|
||||
Reference in new issue
Block a user