worked version of lamp
This commit is contained in:
parent
86523fa5bb
commit
07364460c3
@ -316,11 +316,24 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
|||||||
std::cout << highlightedObjects.size() << std::endl;
|
std::cout << highlightedObjects.size() << std::endl;
|
||||||
for (auto* ao : highlightedObjects) {
|
for (auto* ao : highlightedObjects) {
|
||||||
if (ao && ao->name == "lampe") {
|
if (ao && ao->name == "lampe") {
|
||||||
// ao->activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("base_Base_color_1001.bmp"));
|
// Create a new lamp object with updated texture
|
||||||
gInventoryMap.erase(item->name);
|
ActiveObject updatedLamp = *ao;
|
||||||
objects_in_inventory--;
|
// Change from dark to lit texture
|
||||||
break;
|
updatedLamp.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./base_Base_color_1001.bmp"));
|
||||||
}
|
|
||||||
|
// Replace the old lamp with updated one
|
||||||
|
rooms[current_room_index].removeByPtr(ao);
|
||||||
|
rooms[current_room_index].objects.push_back(updatedLamp);
|
||||||
|
activeObjects = rooms[current_room_index].objects;
|
||||||
|
|
||||||
|
// Remove car from inventory
|
||||||
|
gInventoryMap.erase(item->name);
|
||||||
|
objects_in_inventory--;
|
||||||
|
|
||||||
|
// Play sound effect
|
||||||
|
audioPlayerAsync.playSoundAsync("lamp_on.ogg");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user