feat: add Activateable in Lightkeeper
This commit is contained in:
@@ -64,6 +64,7 @@ public:
|
||||
[[nodiscard]] const std::vector<std::shared_ptr<GameObject>>& GetObjects() const {
|
||||
return m_objects;
|
||||
}
|
||||
[[nodiscard]] GameObject* FindGameObject(ObjectId id) const;
|
||||
|
||||
void SetRegisterBindings(std::function<void()> registerBindings) {
|
||||
m_registerBindings = std::move(registerBindings);
|
||||
|
||||
@@ -205,6 +205,20 @@ CameraComponent* Scene::GetCurrentCamera() const {
|
||||
return cameras.empty() ? nullptr : cameras.front();
|
||||
}
|
||||
|
||||
GameObject* Scene::FindGameObject(ObjectId id) const {
|
||||
if (id == InvalidObjectId) {
|
||||
return nullptr;
|
||||
}
|
||||
for (const auto* objects : {&m_objects, &m_pendingAdditions}) {
|
||||
for (const auto& object : *objects) {
|
||||
if (object != nullptr && !object->IsBeingDestroyed() && object->GetId() == id) {
|
||||
return object.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<CameraComponent*> Scene::GetCameras() const {
|
||||
std::vector<CameraComponent*> cameras;
|
||||
for (const auto& object : m_objects) {
|
||||
|
||||
Reference in New Issue
Block a user