using Godot; public partial class MainMenu : Node2D { private AnimationPlayer _animationPlayer; [Signal] public delegate void IntroAnimationsCompletedEventHandler(); private PlayerInput _player1Input; private PlayerInput _player2Input; public override void _Ready() { GetParent().GetNode("MainMenu/UIAnimations/LoreSplash").Show(); _animationPlayer = GetTree().Root.GetNode("/root/Main/MainMenu/UIAnimations/AnimationPlayer"); _animationPlayer.Play("IntroLore"); var bgmPlayer = GetTree().Root.GetNode("BgmPlayer"); bgmPlayer.SetBGMFromFilepath("Audio/BGM/TitleTheme.ogg"); bgmPlayer.PlayBGM(); _player1Input = new Player1Input(); _player2Input = new Player2Input(); _animationPlayer.AnimationFinished += OnIntroAnimationFinished; } public override void _UnhandledInput(InputEvent @event) { if (_animationPlayer.IsPlaying() && (Input.IsActionJustPressed(_player1Input.Fire()) || Input.IsActionJustPressed(_player2Input.Fire()))) { _animationPlayer.Seek(10); GetNode("NewGame/1Player").GrabFocus(); } } public void OnIntroAnimationFinished(StringName animationName) { GetNode("NewGame/1Player").GrabFocus(); } private void OneSinglePlayerPressed() { Hide(); var main = GetTree().Root.GetNode
("/root/Main"); main.LoadLevel(0, 1); } private void OnTwoPlayerPressed() { Hide(); var main = GetTree().Root.GetNode
("/root/Main"); main.LoadLevel(0, 2); } private void OnQuitButtonPressed() { GetTree().Quit(); } }