Add lobby and scene managers, implement scene switching with fade in/out

This commit is contained in:
2024-08-20 18:47:34 +02:00
parent 0d490be61a
commit 3f64f82464
28 changed files with 353 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
using HurricaneVR.Framework.Core;
using HurricaneVR.Framework.Core.Player;
using HurricaneVR.Framework.Core.Utils;
using UnityEngine;
using Zenject;
@@ -16,6 +17,9 @@ public class GlobalInstaller : MonoInstaller
[SerializeField]
private GameObject playerPrefab;
[SerializeField]
private GameObject sceneManagerPrefab;
public override void Start()
{
base.Start();
@@ -42,12 +46,21 @@ public class GlobalInstaller : MonoInstaller
})
.NonLazy();
Container.Bind<HVRObjectCollisionDisabler>()
Container.Bind<HVRPlayerController>()
.FromComponentInNewPrefab(playerPrefab)
.AsSingle()
.OnInstantiated<HVRObjectCollisionDisabler>((ctx, obj) =>
.OnInstantiated<HVRPlayerController>((ctx, obj) =>
{
obj.name = playerPrefab.name;
obj.transform.parent.name = playerPrefab.name;
})
.NonLazy();
Container.Bind<SceneManager>()
.FromComponentInNewPrefab(sceneManagerPrefab)
.AsSingle()
.OnInstantiated<SceneManager>((ctx, obj) =>
{
obj.name = sceneManagerPrefab.name;
})
.NonLazy();
}

View File

@@ -1,18 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Zenject;
public class LobbyInstaller : MonoBehaviour
public class LobbyInstaller : MonoInstaller
{
// Start is called before the first frame update
void Start()
public override void InstallBindings()
{
Container.Bind<LobbyManager>()
.FromComponentsInNewPrefabResource("Managers/LobbyManager")
.AsSingle()
.OnInstantiated<LobbyManager>((ctx, obj) =>
{
obj.name = "LobbyManager";
})
.NonLazy();
}
// Update is called once per frame
void Update()
{
}
}
}