#include #include namespace XCEngine { namespace Components { TransformComponent& Component::transform() const { return *m_gameObject->GetTransform(); } Scene* Component::GetScene() const { return m_gameObject ? m_gameObject->GetScene() : nullptr; } void Component::SetEnabled(bool enabled) { if (m_enabled == enabled) { return; } bool wasEffectivelyEnabled = m_enabled; bool isEffectivelyEnabled = enabled; if (m_gameObject) { wasEffectivelyEnabled = m_enabled && m_gameObject->IsActiveInHierarchy(); isEffectivelyEnabled = enabled && m_gameObject->IsActiveInHierarchy(); } m_enabled = enabled; if (wasEffectivelyEnabled == isEffectivelyEnabled) { return; } if (isEffectivelyEnabled) { OnEnable(); } else { OnDisable(); } } } }