Refactoring m_isDeactivating into m_isHierarchyEnabled

Signed-off-by: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com>
This commit is contained in:
AMZN-Olex
2021-09-15 18:41:08 -04:00
parent c673988935
commit 9e31c3ebf5
4 changed files with 15 additions and 12 deletions
@@ -78,7 +78,8 @@ namespace Multiplayer
NetworkHierarchyChangedEvent m_networkHierarchyChangedEvent;
NetworkHierarchyLeaveEvent m_networkHierarchyLeaveEvent;
bool m_isDeactivating = false;
//! Set to false when deactivating or otherwise not to be included in hierarchy considerations.
bool m_isHierarchyEnabled = true;
void NotifyChildrenHierarchyDisbanded();
};
@@ -93,7 +93,8 @@ namespace Multiplayer
bool RecursiveAttachHierarchicalChild(AZ::EntityId entity, uint32_t& currentEntityCount);
void SetRootForEntity(AZ::Entity* root, const AZ::Entity* childEntity);
bool m_isDeactivating = false;
//! Set to false when deactivating or otherwise not to be included in hierarchy considerations.
bool m_isHierarchyEnabled = true;
};
}
@@ -67,6 +67,8 @@ namespace Multiplayer
void NetworkHierarchyChildComponent::OnActivate([[maybe_unused]] EntityIsMigrating entityIsMigrating)
{
m_isHierarchyEnabled = true;
HierarchyRootAddEvent(m_hierarchyRootNetIdChanged);
NetworkHierarchyRequestBus::Handler::BusConnect(GetEntityId());
@@ -79,7 +81,7 @@ namespace Multiplayer
void NetworkHierarchyChildComponent::OnDeactivate([[maybe_unused]] EntityIsMigrating entityIsMigrating)
{
m_isDeactivating = true;
m_isHierarchyEnabled = false;
if (m_rootEntity)
{
@@ -96,7 +98,7 @@ namespace Multiplayer
bool NetworkHierarchyChildComponent::IsHierarchyEnabled() const
{
return !m_isDeactivating;
return m_isHierarchyEnabled;
}
bool NetworkHierarchyChildComponent::IsHierarchicalChild() const
@@ -197,11 +199,9 @@ namespace Multiplayer
}
else
{
if (!m_rootEntity)
{
m_rootEntity = nullptr;
m_networkHierarchyLeaveEvent.Signal();
}
m_isHierarchyEnabled = false;
m_rootEntity = nullptr;
m_networkHierarchyLeaveEvent.Signal();
}
}
@@ -71,6 +71,7 @@ namespace Multiplayer
void NetworkHierarchyRootComponent::OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating)
{
m_isHierarchyEnabled = true;
m_hierarchicalEntities.push_back(GetEntity());
NetworkHierarchyRequestBus::Handler::BusConnect(GetEntityId());
@@ -84,7 +85,7 @@ namespace Multiplayer
void NetworkHierarchyRootComponent::OnDeactivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating)
{
m_isDeactivating = true;
m_isHierarchyEnabled = false;
if (m_rootEntity)
{
@@ -121,7 +122,7 @@ namespace Multiplayer
bool NetworkHierarchyRootComponent::IsHierarchyEnabled() const
{
return !m_isDeactivating;
return m_isHierarchyEnabled;
}
bool NetworkHierarchyRootComponent::IsHierarchicalRoot() const