forked from Shardstone/trail-into-darkness
First commit on my server, yey!
This commit is contained in:
37
Assets/Code/Core/SplashGameState.cs
Normal file
37
Assets/Code/Core/SplashGameState.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Nox.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Nox.Core {
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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<DisclaimerReference>();
|
||||
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() { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user