Core: Add DisabledComponent (to temporary disable an entity)

This commit is contained in:
SirLynix
2023-05-07 22:43:48 +02:00
parent c69397707e
commit bbbd3f88c1
10 changed files with 58 additions and 11 deletions

View File

@@ -29,6 +29,7 @@
#ifndef NAZARA_CORE_COMPONENTS_HPP
#define NAZARA_CORE_COMPONENTS_HPP
#include <Nazara/Core/Components/DisabledComponent.hpp>
#include <Nazara/Core/Components/LifetimeComponent.hpp>
#endif // NAZARA_CORE_COMPONENTS_HPP

View File

@@ -0,0 +1,29 @@
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_CORE_COMPONENTS_DISABLEDCOMPONENT_HPP
#define NAZARA_CORE_COMPONENTS_DISABLEDCOMPONENT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Core/Time.hpp>
#include <Nazara/Utility/Config.hpp>
namespace Nz
{
class DisabledComponent
{
public:
DisabledComponent() = default;
DisabledComponent(const DisabledComponent&) = default;
DisabledComponent(DisabledComponent&&) = default;
~DisabledComponent() = default;
DisabledComponent& operator=(const DisabledComponent&) = default;
DisabledComponent& operator=(DisabledComponent&&) = default;
};
}
#endif // NAZARA_CORE_COMPONENTS_DISABLEDCOMPONENT_HPP

View File

@@ -53,6 +53,7 @@ namespace Nz
private:
void OnCameraDestroy(entt::registry& registry, entt::entity entity);
void OnDisabledConstructed(entt::registry& registry, entt::entity entity);
void OnGraphicsDestroy(entt::registry& registry, entt::entity entity);
void OnLightDestroy(entt::registry& registry, entt::entity entity);
void OnNodeDestroy(entt::registry& registry, entt::entity entity);
@@ -116,6 +117,8 @@ namespace Nz
entt::observer m_sharedSkeletonConstructObserver;
entt::observer m_skeletonConstructObserver;
entt::scoped_connection m_cameraDestroyConnection;
entt::scoped_connection m_disabledConstructedConnection;
entt::scoped_connection m_disabledDestroyConnection;
entt::scoped_connection m_graphicsDestroyConnection;
entt::scoped_connection m_lightDestroyConnection;
entt::scoped_connection m_nodeDestroyConnection;