refactor code to be more decoupled

This commit is contained in:
2022-08-14 16:53:44 -04:00
parent 2a7b20ed54
commit 563cdade00
5 changed files with 40 additions and 23 deletions

View File

@@ -81,7 +81,7 @@ void Player::_ready()
}
void Player::_on_monitor_loaded() {
auto object_node = get_tree()->get_root()->get_node("Main")->find_node("Monitor", true);
auto object_node = get_tree()->get_root()->find_node("Monitor", true, false);
if (object_node != nullptr)
{
auto state = get_node("StateMachine")->get_child(0);
@@ -97,10 +97,12 @@ void Player::_on_monitor_loaded() {
WARN_PRINT("State not found!");
}
}
#ifndef NDEBUG
else
{
WARN_PRINT("Monitor not found!");
}
#endif
}
void Player::_physics_process(float delta)