using System.Linq;
using Godot;

public partial class Level1 : Node3D
{
  [Export]
  private Marker3D _spawnPoint;

  public override void _Ready()
  {
    var player = GetTree().Root.GetChildren().OfType<CharacterBody3D>().Single();
    player.Transform = _spawnPoint.Transform;
    var bgmPlayer = GetNode<BGMPlayer>("/root/BgmPlayer");
    GD.Print(bgmPlayer);
    bgmPlayer.SetBGMFromFilepath("res://Audio/BGM/Foothpath.mp3");
    bgmPlayer.PlayBGM();
  }

  public void OnCollisionWithLevelLoader(Node3D node)
  {
    GD.Print("Entered level loader");
    var sceneHandler = GetNode<SceneHandler>("/root/SceneHandler");
    sceneHandler.OnLoadScene("res://Scenes/level_2.tscn");
  }
}
