using Nox.UI; using UnityEngine; using UnityEngine.AddressableAssets; namespace Nox.Core { /// /// This is an example for the first game state which in our case would usually contain a gdpr /// This is an example to show how it could be initialized and also how it could boot into the next game state /// Ideally a SceneHandler/Manager of sorts should handle loading and unloading scenes. /// public class SplashGameState : IGameState { private readonly BootstrapReferences bootStrapInitializer; private readonly GameDataState gameDataState; public bool IsGameStateInitialized { get; set; } = true; public SplashGameState(BootstrapReferences bootStrapInitializer, GameDataState gameDataState) { this.bootStrapInitializer = bootStrapInitializer; this.gameDataState = gameDataState; } public void EnterGameState() { DisclaimerReference gdprReference = Addressables.InstantiateAsync(bootStrapInitializer.splashUIReference).WaitForCompletion().GetComponent(); gdprReference.continueButton.onClick.AddListener(() => { gameDataState.ChangeGameState(GameState.MainMenu); Object.Destroy(gdprReference.gameObject); }); } public GameState Tick() { return GameState.BootState; } public void LateTick() { } public void Dispose() { } public void ExitGameState() { } } }