33 lines
No EOL
959 B
C#
33 lines
No EOL
959 B
C#
using Microsoft.Xna.Framework;
|
|
using Nez;
|
|
using Nez.Sprites;
|
|
|
|
namespace Lighthouse
|
|
{
|
|
public class SplashScene : Scene
|
|
{
|
|
private float _durationSeconds;
|
|
private Scene _nextScene;
|
|
|
|
public SplashScene(string resourceName, float durationSeconds, Scene nextScene)
|
|
{
|
|
SetDesignResolution(640, 360, SceneResolutionPolicy.ShowAllPixelPerfect);
|
|
Screen.SetSize(640*2, 360*2);
|
|
|
|
_durationSeconds = durationSeconds;
|
|
_nextScene = nextScene;
|
|
|
|
var texture = Content.LoadTexture(resourceName);
|
|
var entity = CreateEntity("splash", new Vector2(Screen.Width / 2, Screen.Height / 2));
|
|
entity.AddComponent(new SpriteRenderer(texture));
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
if (Time.TimeSinceSceneLoad >= _durationSeconds)
|
|
{
|
|
Core.Scene = _nextScene;
|
|
}
|
|
}
|
|
}
|
|
} |