Refactor scene management, Enable wasd movement, Add level menu

This commit is contained in:
2024-09-08 22:06:14 +02:00
parent 3357191134
commit d7eb1e65d2
32 changed files with 6964 additions and 2406 deletions

View File

@@ -0,0 +1,57 @@
using HurricaneVR.Framework.Core.UI;
using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using Zenject;
public class LevelMenuUI : MonoBehaviour
{
[Inject]
[ReadOnly]
private HVRInputModule uiInput;
[Inject]
[ReadOnly]
private SceneManager sceneManager;
[SerializeField]
private GameObject levelSelection;
[SerializeField]
private GameObject levelSelectionContent;
[SerializeField]
[ReadOnly]
private Canvas canvas;
[SerializeField]
private GameObject levelItemPrefab;
private void Start()
{
if (uiInput == null) return;
canvas = GetComponent<Canvas>();
uiInput?.AddCanvas(canvas);
UpdateLevelSelection();
}
private void UpdateLevelSelection()
{
foreach (Transform transform in levelSelectionContent.transform)
{
Destroy(transform.gameObject);
}
foreach (var level in sceneManager.Levels)
{
var go = Instantiate(levelItemPrefab);
go.name = level.name;
go.transform.SetParent(levelSelectionContent.transform, false);
go.GetComponent<LevelItemUI>().Setup(level, false);
}
}
}