Story/SceneTransitionTrigger.cs
using Opium;
using Sandbox;
using Sandbox.UI.Story;
public sealed class SceneTransitionTrigger : ActionTrigger
{
[Property] public float Delay { get; set; }
[Property] public SceneFile SceneFile { get; set; }
// TODO: move this lol
[Property] public bool SubmitLeaderboards { get; set; } = false;
protected override void Activate()
{
base.Activate();
DoTransition();
}
async void DoTransition()
{
BlackOverlay.IsOverlayEnabled = true;
// Record leaderboard time
LeaderboardSystem.RecordSpeedrun();
await Task.DelaySeconds( Delay );
Game.ActiveScene.Load( SceneFile );
}
}