using BulletHellTemplate; using UnityEngine; using VContainer; using VContainer.Unity; namespace BulletHellTemplate { /// /// LifetimeScope that binds the chosen backend implementation to IBackendService. /// Place it in the first scene that is loaded. /// public sealed class BackendLifetimeScope : LifetimeScope { [SerializeField] private BackendSettings settings; protected override void Configure(IContainerBuilder builder) { builder.RegisterInstance(settings); switch (settings.option) { case BackendOption.Offline: builder.Register(Lifetime.Singleton) .As(); break; case BackendOption.Firebase: builder.Register(Lifetime.Singleton) .As(); break; case BackendOption.WebSocketSql: builder.Register(Lifetime.Singleton) .As(); break; } builder.RegisterComponentInHierarchy(); } } }