Fix spawn location and on hit
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
|
||||
public partial class MainMenu : Node2D
|
||||
{
|
||||
private AnimationPlayer _player;
|
||||
private AnimationPlayer _animationPlayer;
|
||||
|
||||
[Signal]
|
||||
public delegate void IntroAnimationsCompletedEventHandler();
|
||||
@@ -11,26 +11,42 @@ public partial class MainMenu : Node2D
|
||||
public override void _Ready()
|
||||
{
|
||||
GetParent().GetNode<TextureRect>("MainMenu/UIAnimations/LoreSplash").Show();
|
||||
_player = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
|
||||
_player.Queue("IntroLore");
|
||||
_animationPlayer = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
|
||||
_animationPlayer.Queue("IntroLore");
|
||||
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/titlemusic.wav");
|
||||
bgmPlayer.PlayBGM();
|
||||
}
|
||||
|
||||
private void OnStartButtonPressed()
|
||||
private void OnSinglePlayerPressed()
|
||||
{
|
||||
_player.Play("FirstLevel");
|
||||
_animationPlayer.Play("FirstLevel");
|
||||
Hide();
|
||||
_player.AnimationFinished += OnAnimationFinished;
|
||||
_animationPlayer.AnimationFinished += OnAnimationFinishedCallSinglePlayerStart;
|
||||
}
|
||||
|
||||
private void OnAnimationFinished(StringName animationName)
|
||||
private void OnAnimationFinishedCallSinglePlayerStart(StringName animationName)
|
||||
{
|
||||
if (animationName == "FirstLevel")
|
||||
{
|
||||
var main = GetTree().Root.GetNode<Main>("/root/Main");
|
||||
main.LoadLevel(7);
|
||||
main.LoadLevel(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTwoPlayerPressed()
|
||||
{
|
||||
_animationPlayer.Play("FirstLevel");
|
||||
Hide();
|
||||
_animationPlayer.AnimationFinished += OnAnimationFinishedCallTwoPlayerStart;
|
||||
}
|
||||
|
||||
private void OnAnimationFinishedCallTwoPlayerStart(StringName animationName)
|
||||
{
|
||||
if (animationName == "FirstLevel")
|
||||
{
|
||||
var main = GetTree().Root.GetNode<Main>("/root/Main");
|
||||
main.LoadLevel(0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user