35 lines
893 B
C#
35 lines
893 B
C#
using Godot;
|
|
using System.Linq;
|
|
|
|
public partial class MainMenu : Node2D
|
|
{
|
|
private AnimationPlayer _player;
|
|
|
|
[Signal]
|
|
public delegate void IntroAnimationsCompletedEventHandler();
|
|
|
|
public override void _Ready()
|
|
{
|
|
GetParent().GetNode<TextureRect>("MainMenu/UIAnimations/LoreSplash").Show();
|
|
_player = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
|
|
_player.Queue("IntroLore");
|
|
}
|
|
|
|
private void OnStartButtonPressed()
|
|
{
|
|
_player.Play("FirstLevel");
|
|
Hide();
|
|
_player.AnimationFinished += OnAnimationFinished;
|
|
}
|
|
|
|
private void OnAnimationFinished(StringName animationName)
|
|
{
|
|
if (animationName == "FirstLevel")
|
|
{
|
|
var main = GetTree().Root.GetNode<Main>("Main");
|
|
var firstLevel = main.Levels.First().Instantiate();
|
|
AddChild(firstLevel);
|
|
}
|
|
}
|
|
}
|