A lot of UI work....
opening slash animation main menu load first level
This commit is contained in:
8
Scripts/Main.cs
Normal file
8
Scripts/Main.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class Main : Node
|
||||
{
|
||||
[Export]
|
||||
public Array<PackedScene> Levels;
|
||||
}
|
||||
34
Scripts/MainMenu.cs
Normal file
34
Scripts/MainMenu.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user