#include "exit_door.hpp"
#include "rally_rush_game_mode.hpp"
#include "utils/game_root.hpp"
#include "utils/godot_macros.h"

namespace godot {
void ExitDoor::_bind_methods() {
#define CLASSNAME ExitDoor
}

void ExitDoor::_enter_tree() { GDGAMEONLY();
    this->player = this->get_node<AnimationPlayer>("AnimationPlayer");
    Ref<RallyRushGameMode>(GameRoot3D::get_singleton()->get_game_mode())->connect("all_keys_found", callable_mp(this, &ExitDoor::all_keys_found));
}

void ExitDoor::all_keys_found() {
    this->player->play("open");
}
}
