remove Player.hitbox (WIP)
This commit is contained in:
@@ -129,20 +129,18 @@ std::shared_ptr<UINode> create_debug_panel(
|
||||
auto box = std::make_shared<TextBox>(L"");
|
||||
auto boxRef = box.get();
|
||||
box->setTextSupplier([=]() {
|
||||
Hitbox* hitbox = player->hitbox.get();
|
||||
return util::to_wstring(hitbox->position[ax], 2);
|
||||
return util::to_wstring(player->getPosition()[ax], 2);
|
||||
});
|
||||
box->setTextConsumer([=](const std::wstring& text) {
|
||||
try {
|
||||
glm::vec3 position = player->hitbox->position;
|
||||
glm::vec3 position = player->getPosition();
|
||||
position[ax] = std::stoi(text);
|
||||
player->teleport(position);
|
||||
} catch (std::exception& _){
|
||||
}
|
||||
});
|
||||
box->setOnEditStart([=](){
|
||||
Hitbox* hitbox = player->hitbox.get();
|
||||
boxRef->setText(std::to_wstring(int(hitbox->position[ax])));
|
||||
boxRef->setText(std::to_wstring(static_cast<int>(player->getPosition()[ax])));
|
||||
});
|
||||
box->setSize(glm::vec2(230, 27));
|
||||
|
||||
|
||||
@@ -136,9 +136,13 @@ void LevelScreen::update(float delta) {
|
||||
bool paused = hud->isPause();
|
||||
audio::get_channel("regular")->setPaused(paused);
|
||||
audio::get_channel("ambient")->setPaused(paused);
|
||||
glm::vec3 velocity {};
|
||||
if (auto hitbox = player->getHitbox()) {
|
||||
velocity = hitbox->velocity;
|
||||
}
|
||||
audio::set_listener(
|
||||
camera->position-camera->dir,
|
||||
player->hitbox->velocity,
|
||||
velocity,
|
||||
camera->dir,
|
||||
glm::vec3(0, 1, 0)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user