block materials loading
This commit is contained in:
@@ -8,16 +8,17 @@
|
||||
#include "../voxels/Block.h"
|
||||
#include "../assets/Assets.h"
|
||||
#include "../graphics/Atlas.h"
|
||||
#include "../content/Content.h"
|
||||
|
||||
#include "../logic/LevelController.h"
|
||||
#include "../logic/PlayerController.h"
|
||||
|
||||
LevelFrontend::LevelFrontend(Level* level, Assets* assets)
|
||||
: level(level),
|
||||
assets(assets),
|
||||
contentCache(std::make_unique<ContentGfxCache>(level->content, assets)),
|
||||
blocksAtlas(BlocksPreview::build(contentCache.get(), assets, level->content)) {
|
||||
}
|
||||
: level(level),
|
||||
assets(assets),
|
||||
contentCache(std::make_unique<ContentGfxCache>(level->content, assets)),
|
||||
blocksAtlas(BlocksPreview::build(contentCache.get(), assets, level->content))
|
||||
{}
|
||||
|
||||
void LevelFrontend::observe(LevelController* controller) {
|
||||
controller->getPlayerController()->listenBlockInteraction(
|
||||
@@ -25,9 +26,12 @@ void LevelFrontend::observe(LevelController* controller) {
|
||||
if (type != BlockInteraction::step) {
|
||||
return;
|
||||
}
|
||||
// (test code)
|
||||
// TODO: replace with BlockMaterial properties access
|
||||
auto sound = assets->getSound("steps/"+def->material.substr(def->material.find(':')+1));
|
||||
auto material = level->content->findBlockMaterial(def->material);
|
||||
if (material == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto sound = assets->getSound(material->stepsSound);
|
||||
audio::play(
|
||||
sound,
|
||||
glm::vec3(),
|
||||
|
||||
Reference in New Issue
Block a user